[Python-Dev] constant/enum type in stdlib (original) (raw)

Barry Warsaw barry at python.org
Tue Nov 23 17:27:03 CET 2010


On Nov 23, 2010, at 01:50 PM, Michael Foord wrote:

Right. As it happens I just submitted a patch to Barry Warsaw's enum package (nice), flufl.enum [1], to allow namedtuple style creation of named constants:

Thanks for the plug (and the nice patch).

FWIW, the documentation for the package is here:

http://packages.python.org/flufl.enum/

I made some explicit decisions about the API and semantics of this package, to fit my own use cases and sensibilities. I guess you wouldn't expect anything else , but I'm willing to acknowledge that others would make different decisions, and certainly the number of existing enum implementations out there proves that there are lots of interesting ways to go about it.

That said, there are several things I like about my package:

In any case it may be that enums are too tied to specific use cases to find a good common ground for the stdlib. I've been using my module for years and if there's interest I would of course be happy to donate it for use in the stdlib. Like the original sets implementation, it makes perfect sense to provide them in a separate module rather than as a built-in type.

-Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: not available URL: <http://mail.python.org/pipermail/python-dev/attachments/20101123/0d891968/attachment.pgp>



More information about the Python-Dev mailing list