[Python-Dev] constant/enum type in stdlib
solipsis at pitrou.net
Tue Nov 23 22:15:20 CET 2010
Le mardi 23 novembre 2010 à 16:10 -0500, Glyph Lefkowitz a écrit :
> On Nov 23, 2010, at 10:01 AM, Antoine Pitrou wrote:
> > Well, it is easy to assign range(N) to a tuple of names when
> > desired. I
> > don't think an automatically-enumerating constant generator is
> > needed.
> I don't think that numerical enumerations are the only kind of
> constants we're talking about. Others have already mentioned strings.
> Also, see <http://tm.tl/4671> for some other use-cases. Since this
> isn't coming to 2.x, we're probably going to do our own thing anyway
> (unless it turns out that flufl.enum is so great that we want to add
> another dependency...) but I'm hoping that the outcome of this
> discussion will point to something we can be compatible with.
I think that asking for too many features would get in the way, and also
make the API quite un-Pythonic. If you want your values to be e.g.
OR'able, just choose your values wisely ;)
More information about the Python-Dev