[Python-ideas] constant/enum type in stdlib
Greg Ewing
greg.ewing at canterbury.ac.nz
Wed Jan 30 00:26:35 CET 2013
Eli Bendersky wrote:
> I really wish there would be an enum type in Python that would make
> sense. ISTM this has been raised numerous times, but not one submitted a
> good-enough proposal.
I think the reason the discussion petered out last time
is that everyone has a slightly different idea on what
an enum type should be like. A number of proposals were
made, but none of them stood out as being the obviously
right one to put in the std lib.
Also, so far nobody has come up with a really elegant
solution to the DRY problem that inevitably arises in
connection with enums. Ideally you want to be able to
specify the names of the enums as identifiers, and not
have to write them again as strings or otherwise provide
explicit values for them. That seems to be very difficult
to achieve cleanly with Python syntax as it stands.
--
Greg
More information about the Python-ideas
mailing list