Skip to content

Weird enum.Enum signature? #132543

Open
Open
@ego-thales

Description

@ego-thales

Hello,

I'm wondering the following regarding Enum.__signature__:

  1. Why return a str (better suited for __text_signature__ isn't it?)
  2. When there are members, why choose '(*values)' over the more accurate (I think) '(value)'?

cpython/Lib/enum.py

Lines 1148 to 1150 in f218549

def __signature__(cls):
if cls._member_names_:
return '(*values)'

If acted upon, I think it would be better to replace current signatures with Signature types. For example for enums with members:

__signature__ = Signature([Parameter("value", Parameter.POSITIONAL_OR_KEYWORD)])

All the best!

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions