Tricks to do "enums"?

Neil Schemenauer nascheme at enme.ucalgary.ca
Mon May 8 00:31:06 EDT 2000


Courageous <jkraska1 at san.rr.com> wrote:
[on using strings as enums]
>Ouch. That could get to be expensive, if you're repetively evaluating
>them.

You shouldn't be if your using them like enums.  Your not even
doing string comparisons.  Python is byte compiled.  Strings that
appear in the source are interned.  Comparing two interned
strings is just a pointer comparison.

Python is dynamic by its not Tcl.  :)

    Neil

-- 
"All truth passes through three stages: first, it is ridiculed; next it is
violently attacked; finally, it is held to be self-evident." -- Schopenhauer



More information about the Python-list mailing list