(no subject)

Michele Simionato mis6+ at pitt.edu
Fri Jan 31 16:31:06 EST 2003


Chad Netzer wrote:
> 
> On Fri, 2003-01-31 at 11:41, mis6 at pitt.edu wrote:
> > Subject: adding to __builtins__
> >
> > Consider the following script (I need it under Python 2.2, where True and
> > False are undefined):
> 
> ????
> 
> $ python
> Python 2.2.2 (#1, Jan 18 2003, 10:18:59)
> >>> True
> 1
> >>> False
> 0
> 
> Was this not added in 2.2.0?

Strangely enough, no.

> 
> In any case, your truefalse.py should definitely check to see if True,
> False are not already defined and exist in builtin, rather than just
> forcibly adding them to __builtin__, since they might become keywords at
> some point, or might not be allowed to be changed in __builtin__ (??).

I posted a stripped version of my code, In the original I check against
sys.version before changing  __builtin__

> Furthermore, they will become type bool, so it may be best to define
> True = (1==1) and False = (0==1), or some such thing.

Nice idea, I will do that way.
 
> These things *might* be helpful for future compatibility (but are
> probably overkill).
> 
> --
> Bay Area Python Interest Group - http://www.baypiggies.net/
> 
> Chad Netzer
> (any opinion expressed is my own and not NASA's or my employer's)


Thanks, (to Skip too)

-- 
Michele Simionato - Dept. of Physics and Astronomy
210 Allen Hall Pittsburgh PA 15260 U.S.A.
Phone: 001-412-624-9041 Fax: 001-412-624-9163
Home-page: http://www.phyast.pitt.edu/~micheles/





More information about the Python-list mailing list