Skip to content

gh-104683: Argument clinic: use an enum to describe the different kinds of functions - #106721

Merged
AlexWaygood merged 2 commits into
python:mainfrom
AlexWaygood:clinic-enums
Jul 13, 2023
Merged

gh-104683: Argument clinic: use an enum to describe the different kinds of functions#106721
AlexWaygood merged 2 commits into
python:mainfrom
AlexWaygood:clinic-enums

Conversation

@AlexWaygood

@AlexWaygoodAlexWaygood commented Jul 13, 2023

Copy link
Copy Markdown
Member

Comment on lines +2460 to +2465
INVALID: Final = FunctionKind.INVALID
CALLABLE: Final = FunctionKind.CALLABLE
STATIC_METHOD: Final = FunctionKind.STATIC_METHOD
CLASS_METHOD: Final = FunctionKind.CLASS_METHOD
METHOD_INIT: Final = FunctionKind.METHOD_INIT
METHOD_NEW: Final = FunctionKind.METHOD_NEW

@AlexWaygoodAlexWaygoodJul 13, 2023

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

It would be nice if we could use the @enum.global_enum decorator on the FunctionKind class; that would make this bit less verbose. Unfortunately, it was added in Python 3.11, and we still support Python 3.10 in argument clinic. Mypy also doesn't support global_enum yet.

@erlend-aasland

erlend-aasland commented Jul 13, 2023

Copy link
Copy Markdown
Contributor

LGTM! Let's wait for #106368 to land.

Also, this is a very nice improvement. Thanks!

@AlexWaygood
AlexWaygood enabled auto-merge (squash) July 13, 2023 22:21
@AlexWaygood
AlexWaygood merged commit 128a6c1 into python:mainJul 13, 2023
kgdiem pushed a commit to kgdiem/cpython that referenced this pull request Jul 14, 2023
…nt kinds of functions (python#106721)
Argument clinic: use an enum to describe the different kinds of functions
@AlexWaygood
AlexWaygood deleted the clinic-enums branch July 26, 2023 10:09
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@AlexWaygood@erlend-aasland@bedevere-bot