Loop until condition is true

Michael Hoffman cam.ac.uk at mh391.invalid
Thu Jun 23 12:38:19 EDT 2005


Antoon Pardon wrote:
> Op 2005-06-22, Michael Hoffman schreef <cam.ac.uk at mh391.invalid>:
> 
>>Remi Villatel wrote:
>>
>>>Fredrik Lundh wrote:
>>>
>>>>checking if a logical expression is true by comparing it to True is bad
>>>>style, and comparing values using "is" is also bad style.
>>>
>>>I wrote it this way because, first, it's perfectly valid Python code and,
>>>second and most important, it's also a valid english sentence.
>>
>>As others have pointed out, it's not perfectly valid code. In fact it is 
>>frequently incorrect.
> 
> 
> That the same code would be incorrect in other circumstances doesn't
> make it invalid as it was used in a specific situation.
> 
> I have written code my self with an "if var is True" statement and
> that is exactly what I wanted. Replacing it with "if var" would
> have broken the the program.

That point was not lost on me (which is why I said it was frequently 
incorrect). I think it was lost on the OP though.
-- 
Michael Hoffman



More information about the Python-list mailing list