Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 3.8 typing syntax #3578

Merged
merged 1 commit into from
Apr 13, 2023
Merged

Use 3.8 typing syntax #3578

merged 1 commit into from
Apr 13, 2023

Conversation

jstvz
Copy link
Contributor

@jstvz jstvz commented Apr 13, 2023

Support for PEP 604 union types was added in 3.101:

Python 3.8.16 (default, Dec  8 2022, 14:03:21)
[Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> mystr: str | None = None or str
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

(Also, :walrus:)

Footnotes

  1. Personally, I'd rather drop 3.8/3.9 instead 😏

Support for PEP 604 union types was added in 3.10:

```python-console
Python 3.8.16 (default, Dec  8 2022, 14:03:21)
[Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> mystr: str | None = None or str
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
```

(Also, :walrus:)
@jstvz jstvz requested a review from a team as a code owner April 13, 2023 15:45
@jstvz jstvz enabled auto-merge (squash) April 13, 2023 15:46
@jstvz jstvz merged commit b8f974c into main Apr 13, 2023
@jstvz jstvz deleted the py38-typing branch April 13, 2023 16:11
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