Aaron Koch <aaronkoc...@yahoo.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45473>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to