-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Enum now accepts String literals and final ... #8664
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
Enum now accepts String literals and final ... #8664
Conversation
values as 2nd arg. This aims to solve python#8219
3128260
to
60371be
Compare
cc @sobolevn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sobolevn Do you have any suggestions on this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I've missed it! Thanks for the ping 🙂
test-data/unit/check-newsemanal.test
Outdated
from typing_extensions import Final | ||
|
||
x: Final['str'] = 'ANT BEE CAT DOG' | ||
Animal = Enum('Animal', x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also check that Animal.ANT
, Animal.BEE
, etc are available in both test cases.
cc @sobolevn |
…8664) Related python#8219 Co-authored-by: Jingchen Ye <[email protected]>
This aims to solve #8219
This PR is still a draft, but am I going in the right direction ? I am doing lot of if refinements from line 150, in order to be compliant with mypy linting, maybe there is a less clunky way to achieve the same result ? Also, should the following cases typecheck ?
Moreover, I had to add
[builtins fixtures/tuple.pyi]
in my tests, they would otherwise crash, but I am not sure to understand why.