Modifying Element In For List

Steve Holden steve at holdenweb.com
Fri Nov 19 12:31:47 EST 2010


On 11/19/2010 12:17 PM, Johannes Bauer wrote:
> Am 15.11.2010 18:27, schrieb Duncan Booth:
> 
>> Comparing directly against True or False is error prone: a value in 
>> Python can be false without actually being equal to False.
> 
> Well, you can always use "is" instead of "==", which makes a comparison
> to True or False perfectly safe.
> 
But it's still the wrong thing to do.

if condition==True:

and

if condition is True:

should both be replaced (under most circumstances) by

if condition:

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/




More information about the Python-list mailing list