True

David Eppstein eppstein at ics.uci.edu
Sun Oct 19 11:17:15 EDT 2003
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

My hope is that setting up True and False in this convoluted way will 
allow it to continue to work in some future version where assignment to 
builtins is disallowed.

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list