True
Andrew Bennetts
andrew-pythonlist at puzzling.org
Mon Oct 20 05:50:05 EDT 2003
On Sun, Oct 19, 2003 at 08:17:15AM -0700, David Eppstein wrote:
> In article <3f929cf0$1_1 at themost.net>,
> "Paul Watson" <pwatson at redlinec.com> wrote:
>
> > Then, what is the best way to write boolean operations for Python 2.1 so
> > that it will be as 2.3+ ready as possible?
>
> I've been including the following at the start of some of my code:
>
> if 'True' not in globals():
> globals()['True'] = not None
> globals()['False'] = not True
Why not simply:
try:
True
except NameError:
True = (1 == 1) # or not None, if you prefer
False = not True
Or were you trying to change the __builtins__ by using globals()?
-Andrew.
More information about the Python-list
mailing list