Skip to content

PEP 604: Add or operator to class type - #5150

Closed
mano7onam wants to merge 1 commit into
python:masterfrom
mano7onam:master
Closed

mano7onam wants to merge 1 commit into
python:masterfrom
mano7onam:master

Conversation

@mano7onam

Copy link
Copy Markdown
Contributor

Python 3.10 allowing writing union types as X | Y so class type now should have operator or

@mano7onam mano7onam closed this Mar 29, 2021
@github-actions

Copy link
Copy Markdown
Contributor

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

pandas (https://github.com/pandas-dev/pandas.git)
+ pandas/core/generic.py:11131: error: unused 'type: ignore' comment

@Akuli Akuli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this PR closed?

Comment thread stdlib/builtins.pyi
def __subclasscheck__(self, subclass: type) -> bool: ...
@classmethod
def __prepare__(metacls, __name: str, __bases: Tuple[type, ...], **kwds: Any) -> Mapping[str, Any]: ...
def __or__(self, t: type) -> type: ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could wrap this inside if sys.version_info >= (3, 10)

@mano7onam mano7onam Mar 29, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I forgot about it and decided to close pr. I'll do it and create new one

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also change a pull request by pushing more commits to your branch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, next time I will do this way

@Akuli

Akuli commented Mar 29, 2021 •

Copy link
Copy Markdown
Collaborator

Replaced by #5151

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.

3 participants