Python 2.3 True = False

Erik Max Francis max at alcyone.com
Mon Mar 24 02:16:17 EST 2003


Anand wrote:

> has anyone tried this before?

No different than the other Python "constants":

>>> None = 'asdf'
<stdin>:1: SyntaxWarning: assignment to None
>>> int = float
>>> import types
>>> types.StringType = types.IntType
>>> import time
>>> time.time = lambda: 0

Assignment to None, by special dispensation, gives you a SyntaxWarning. 
All of these things are ProgrammerDoingSomethingHeShouldntWarnings. 
Python doesn't have true constants (in the sense that what the point to
is no longer mutable or that the name is no longer rebindable, whichever
you might mean); it just has things which are officially special names
that a well-behaved program shouldn't fiddle with.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ But tell me, who _are_ they, these wanderers ... ?
\__/ Rainer Maria Rilke
    Discord / http://www.alcyone.com/pyos/discord/
 Convert dates from Gregorian to Discordian.




More information about the Python-list mailing list