Type hint inconsistency for `shape`
See original GitHub issuegave this warning in VS Code
Argument of type "tuple[int, int]" cannot be assigned to parameter "shape" of type "int | Tuple[()] | Tuple[int]" in function "Zeros"
Type "tuple[int, int]" cannot be assigned to type "int | Tuple[()] | Tuple[int]"
"tuple[int, int]" is incompatible with "int"
Tuple size mismatch; expected 0 but received 2
Tuple size mismatch; expected 1 but received 2PylancereportGeneralTypeIssues
Need to make shape
type hint accept a tuple with any number of integer arguments.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Writing Good Code - Python Like You Mean It
This is a good place to embellish the type information with pertinent information that is not conveyed by the formal type-hints. For example,...
Read more >PEP 484 Type Annotations (feature request) #12345 - GitHub
System information N/A Describe the problem Background PEP 484 [1] added support for type hints in Python. These are purely annotations and ...
Read more >Understanding type annotation in Python - LogRocket Blog
With type hints, you can annotate variables and functions with datatypes. Tools like mypy, pyright, pytypes, or pyre perform the functions of ...
Read more >Python's “type hints” are a bit of a disappointment to me
Honestly, I've recently written a few 300-500 line programs in Python using type hints and I'm never going back. And I'm not even...
Read more >Type annotations for *args and **kwargs - Stack Overflow
Arbitrary argument lists can as well be type annotated, ... *args always means 0 or more, and can't be limited by type hints...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@iyanmv please keep opening issues or commenting when you find weird/strange type hint warnings/errors. That’s really helpful for me! 👍
Never mind… I think PyCharm needed some extra time when changing from one interpreter to another.
Sequence[int]
works for me as well.