Tricks to do "enums"?

Courageous jkraska1 at san.rr.com
Mon May 8 01:50:18 EDT 2000


> "==" works just as well.  Python smart enough to try a pointer
> compare first.  The code path is almost the same so I doubt there
> would be much speed gained by using "is".

Well that's cool. The next question is...

Do all string constants which are lexically equivalent obey
the identity rule? IOW, does the python byte compiler know
how, upon compilation, to make two seperate instance of
"joe" point to the same single instance?

If so, what are the limits of the byte compiler at merging
string identities? For example, will eval() do a prepass
through the code and determine identity?


C/



More information about the Python-list mailing list