Skip to content

Use TypeAlias in builtins and complete a TODO item#9170

Closed
sobolevn wants to merge 1 commit intopython:mainfrom
sobolevn:builtins-todo
Closed

Use TypeAlias in builtins and complete a TODO item#9170
sobolevn wants to merge 1 commit intopython:mainfrom
sobolevn:builtins-todo

Conversation

@sobolevn
Copy link
Copy Markdown
Member

From #9158 I understood that explicit type aliases are not a goal. But, this one is special. It has a TODO item and some history to it.

I am also curious about whether mypy now supports it.

@sobolevn
Copy link
Copy Markdown
Member Author

stdlib/builtins.pyi:195: error: Unsupported left operand type for | ("object") [operator]

Not today!

@sobolevn sobolevn closed this Nov 12, 2022
@github-actions
Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

Expression (https://github.com/cognitedata/Expression)
+ expression/collections/block.py:317: error: Incompatible return value type (got "int", expected "Union[_TSourceSum, Literal[0]]")  [return-value]
+ expression/collections/block.py:1036: error: Incompatible return value type (got "int", expected "Union[_TSourceSum, Literal[0]]")  [return-value]
+ expression/collections/block.py:1043: error: Incompatible return value type (got "int", expected "Union[_TSourceSum, Literal[0]]")  [return-value]

ignite (https://github.com/pytorch/ignite)
+ ignite/handlers/time_profilers.py:607: error: Incompatible types in assignment (expression has type "float", variable has type "int")  [assignment]

@AlexWaygood
Copy link
Copy Markdown
Member

I am also curious about whether mypy now supports it.

I haven't checked yet, but I wonder if python/mypy#14008 might have fixed this bug (not yet released, will be released as part of mypy 1.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants