integer >= 1 == True and integer.0 == False is bad, bad, bad!!!

Paul Rubin no.email at nospam.invalid
Mon Jul 12 23:22:39 EDT 2010


Steven D'Aprano <steve-REMOVE-THIS at cybersource.com.au> writes:
> Writing the  explicit tests:
> if bool(myInt):
> or even:
> if myInt <> 0:
>
> are firmly in the same category. The only difference is that it is more 
> familiar and therefore comfortable to those who are used to languages 
> that don't have Python's truth-testing rules.

It's like list.append returning None.  It helps catch errors.



More information about the Python-list mailing list