Assign to True / False in 2.3

Culley Angus spam at nothing.nowhere
Wed Jul 2 05:39:40 EDT 2003


Just downloaded the latest beta of 2.3, and having a bit of fun playing 
with the new goodies, lovely work by the way :)

I was a little suprised to find that I could assign a value to 'True', 
and 'False' without warning though, and was wondering if this is deliberate.

For example:
if (1 == True): print "true"
True = 0
if (1 == True): print "true"
else: print "true is false"

This snippet is fairly unlikely to ever be written by a sober 
individual, but if something similar is constructed by accident, the 
repercussions may be interesting if not detected.

Can True (or False for that matter) be relied on for this sort of direct 
comparison?.





More information about the Python-list mailing list