[Python-Dev] constant/enum type in stdlib

Michael Foord fuzzyman at voidspace.org.uk
Sun Nov 28 14:48:08 CET 2010


On 28/11/2010 03:20, Terry Reedy wrote:
> On 11/27/2010 6:26 PM, Raymond Hettinger wrote:
>
>> Can I suggest that an enum-maker be offered as a third-party module
>
> Possibly with competing versions for trial and testing ;-)
>
>> rather than prematurely adding it into the standard library.
>
> I had same thought.
>

There are already *several* enum packages for Python available. The 
implementation by Ben Finney, associated with the previous PEP, is on 
PyPI and the most recent release has over 4000 downloads making it 
reasonably popular:

http://pypi.python.org/pypi/enum/

Other contenders include flufl.enum and lazr.enum. The Twisted guys 
would like a named constant type, and have a ticket for it, and PyQt has 
its own implementation (subclassing int) providing this functionality. 
In terms of assessing *general* usefulness in the wider community that 
step has already been done.

This discussion came out of yet-another-set-of-integer-constants being 
added to the Python standard library (since changed to strings). We have 
integer constants, with the associated inscrutability when used from the 
interactive interpreter or debugging, in *many* standard library 
modules. The particular features and use cases being discussed have use 
*within* the standard library in mind.

Releasing yet-another-enum-library-that-the-standard-library-can't-use 
would be a particularly pointless outcome of this discussion. The 
decision is whether or not to use named constants in the standard 
library, otherwise we can just point people at one of the several 
existing packages.

All the best,

Michael Foord

-- 

http://www.voidspace.org.uk/

READ CAREFULLY. By accepting and reading this email you agree,
on behalf of your employer, to release me from all obligations
and waivers arising from any and all NON-NEGOTIATED agreements,
licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,
confidentiality, non-disclosure, non-compete and acceptable use
policies (”BOGUS AGREEMENTS”) that I have entered into with your
employer, its partners, licensors, agents and assigns, in
perpetuity, without prejudice to my ongoing rights and privileges.
You further represent that you have the authority to release me
from any BOGUS AGREEMENTS on behalf of your employer.



More information about the Python-Dev mailing list