True inconsistency in Python

Borcis borcis at users.ch
Thu Nov 13 12:01:55 CET 2003


Scott Chapman wrote:

> 
> if var == True: # only works if var is 1
>   blah
> 
> ' Must use:
> 
> if var: # works if var is not 0
>   blah

there's the equivalent, and more explicit :

if bool(var)==True : blah





More information about the Python-list mailing list