question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some issues with type annotations

See original GitHub issue

Some issues with type annotations that were brought up by @Bvb93 at https://github.com/numpy/numpy/pull/18585

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
rgommerscommented, Mar 13, 2021

For stack and concat (and possibly others), Tuple is too restrictive vs. Sequence.

I’m actually not sure Sequence is a good idea. It can be quite hard to deal with this correctly in both Python and C/C++, see e.g. https://stackoverflow.com/questions/43566044/what-is-pythons-sequence-protocol. I remember a lot of cases where we special-cased tuple and list inputs, and other kinds of sequences were doing the wrong thing.

I can be convinced that accepting Union[Tuple[<array>, ...], List[<array>]] is a good idea, but I don’t think Sequence is.

0reactions
kgrytecommented, Nov 4, 2021

As all items in this tracking issue have been addressed, will close. Any further issues can be discussed in a new issue and resolved in follow-up PRs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue about type annotation - microsoft/pylance-release - GitHub
I think we should allow type modification after function returns. This is essential for Union and subclass. See 2 cases below: from typing ......
Read more >
Common issues and solutions - mypy 0.991 documentation
Functions that do not have any annotations (neither for any argument nor for the return type) are not type-checked, and even the most...
Read more >
Understanding type annotation in Python - LogRocket Blog
In this extensive post with specific examples, learn how to use Python type annotation to your advantage using the mypy library.
Read more >
Type Annotation in Python | Towards Data Science
Type annotations — also known as type signatures — are used to indicate the datatypes of variables and input/outputs of functions and methods....
Read more >
Using Type Annotations to Improve Your Code
Survey: Did you attend the tutorial? The locking talk? Which of these best describes you? ○ Specific question / concern / feedback. ○...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found