Enumeration idioms: Values from different enumerations

Paul Rubin http
Fri Dec 16 07:43:34 EST 2005


Ben Finney <bignose+hates-spam at benfinney.id.au> writes:
> This gives meaning to the "equal value" comparisons, but ensures that
> other comparisons are errors.
> 
> Comments so far?

What does copy.copy of an enumeration value do?  What happens if you
have a list with some enumeration values inside, and you make a
deepcopy of it?  What happens if you pickle an enum, then unpickle the
pickle and compare what comes out to the other enum?

All in all, comparing by object identity doesn't sound too good.
Maybe you want to have the enum contain its own name internally, and
do a string comparison.



More information about the Python-list mailing list