This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aekoch
Recipients aekoch, ethan.furman
Date 2021-10-14.23:11:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1634253118.26.0.736795469512.issue45473@roundup.psfhosted.org>
In-reply-to
Content
Are there any other names that you would contemplate besides `from_name` and `from_value`?  My reading of your response indicates that you are fundamentally opposed to the addition of class methods, since they would limit the space of possible instance methods/members.  Is that a fair reading?

If it is not, would you be open to different method names?

Do you agree with the fundamental issue that is identified: that the parenthesis/square bracket construction is difficult to read and makes implementation mistakes more likely?  That it would be good to have some what to make it more explicit at both read and write time whether the enum is being constructed using the name or the value.

One alternative to the class methods I might propose is to use a keyword argument in the __init__ function.
SomeEnum(name="foo")
SomeEnum(value="bar")

This would also solve the stated problem, but I suspect that messing with the init function introduces more limitations to the class than the classmethod solution.
History
Date User Action Args
2021-10-14 23:11:58aekochsetrecipients: + aekoch, ethan.furman
2021-10-14 23:11:58aekochsetmessageid: <1634253118.26.0.736795469512.issue45473@roundup.psfhosted.org>
2021-10-14 23:11:58aekochlinkissue45473 messages
2021-10-14 23:11:58aekochcreate