correct way to check for True in __builtins__?
Mark McEahern
mark at mceahern.com
Fri May 10 19:26:24 EDT 2002
I want to check whether True is builtin and I thought I'd be clever by
saying:
if True not in __builtins__:
True = bool(1)
False = bool(0)
of course, __builtins__ doesn't seem to be built to be accessed that way.
http://mail.python.org/pipermail/pythonmac-sig/2001-April/003285.html
I could also do:
import sys
# examine sys.version_info tuple, if it's less than 2, 2, 1...
Or:
if True in dir(__builtins__):
...
Is there a preferred way to do this?
Thanks,
// mark
More information about the Python-list
mailing list