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

Added draft chapter to typing spec for enumerations. #1591

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

erictraut
Copy link
Collaborator

No description provided.

docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
Copy link
Member

@ethanfurman ethanfurman left a comment

Choose a reason for hiding this comment

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

Added some corrections and suggestions.

docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
consistency. That is, if the type is assigned to a variable, the name of
the variable must match the name of the enum class::

WrongName = Enum('Color', 'RED GREEN BLUE') # Type checker error
Copy link
Member

Choose a reason for hiding this comment

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

Not sure this should be an error, commented on Discuss

docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Outdated Show resolved Hide resolved
docs/spec/enums.rst Show resolved Hide resolved
@erictraut
Copy link
Collaborator Author

@JelleZijlstra, did mypy 1.9 fix the issue in stubtest that was blocking us from making the necessary changes in typeshed for enums? If not, is that something that could be prioritized for mypy 1.10?

…'t apply to enum classes that derive from `enum.Flags` because these classes support enum members with values of zero and all combinations of the defined flags.
Copy link

@Hnasar Hnasar left a comment

Choose a reason for hiding this comment

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

Very well written, thank you!

docs/spec/enums.rst Outdated Show resolved Hide resolved
erictraut and others added 2 commits April 1, 2024 07:06
Co-authored-by: Hashem <Hnasar@users.noreply.github.com>
…ther an attribute is an enum member. Attributes with private (mangled) names are exempt.
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.

None yet

9 participants