Aaron Brady
3/12/2008 6:30:00 AM
> > [enums snip]
> Thus, those names are all bound to unique objects, that won't be
> unexpectedly duplicated by some other value.
>
> > but I'm curious if there's a better way of doing this, some kind of
> > enum-like thing or somesuch.
>
> Please try the 'enum' package in the Cheeseshop:
Am I the only one superstitious about putting identifiers in strings?
> When a well-packaged web of lies has been sold to the masses
... someone sold them.
>>> c= type('Enum',(),{})
>>> [ setattr( c, v, object() ) for v in 'py funcpre funcpost'.split() ]
[None, None, None]
>>> c.funcpost
<object object at 0x00A37478>
>>> c.funcpre
<object object at 0x00A37470>
You don't need them to be ints or anything, do you, like USER_BASE+ 1?