Tricks to do "enums"?

Courageous jkraska1 at san.rr.com
Mon May 8 03:52:48 EDT 2000


>     >>> a = "a"
>     >>> eval("'a' is a")
>     1

So, it would appear that the limit would be uneval'd
strings, potentially taken from the user or a file. I
suspect that even if you can't eval strings, this is
probably one of the reasons why the intern() function
exists. You can grab a string from a non constant
external source, and attempt to give it identity, based
on previously existing known string identities. Very
cool indeed.

This isn't something c or c++ can do for you, either.




C/



More information about the Python-list mailing list