while 1 vs while True

Peter Hansen peter at engcorp.com
Wed Dec 15 10:25:38 EST 2004


Paul Rubin wrote:
> Nick Coghlan <ncoghlan at iinet.net.au> writes:
> 
>>Until this code:
>>
>>.>>> import pdb
>>.>>> pdb.True = 0
>>.>>> pdb.x = "Darn writeable module dictionaries"
>>.>>> from pdb import True
>>.>>> True
>>0
>>.>>> from pdb import x
>>.>>> x
>>'Darn writeable module dictionaries'
> 
> 
> If Python really does behave that way, that bug should be fixed immediately.

(My ISP's news server seems to be dropping messages, so I didn't
see Nick's original message above, nor perhaps the message he
was replying to.  I hope that doesn't matter to my reply...)

Paul, what is wrong with the above behaviour, that you believe it
to indicate a bug?

As Nick showed in his following reply, there are certainly
people who make use of this behaviour, and I don't believe
it could be duplicated with any other existing feature of
Python.  Removing it would, for but one example, cripple
my ability to do effective automated testing in my field
of work.

-Peter



More information about the Python-list mailing list