That's a problem with any attempt to find an enum member by value, since values aren't guaranteed to be unique. With either proposal, we'd just need to pick one - probably the one that appears first in the class dict. On Tue, Mar 16, 2021, 2:39 PM Marco Sulla <Marco.Sulla.Python@gmail.com> wrote:
On Tue, 16 Mar 2021 at 05:38, Matt Wozniski <godlygeek@gmail.com> wrote:
Color.from_value(1) # returns Color.RED
What if I have an alias? _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/NQ535P... Code of Conduct: http://python.org/psf/codeofconduct/