Equivalent code to the bool() built-in function

Ned Deily nad at acm.org
Mon Apr 18 00:40:48 EDT 2011

Chris Angelico:
>  Dave Angel:
> >>>> bool = int
> Any language that allows you to do this is either awesome or
> terrifying. Come to think of it, there's not a lot of difference.

Even better:
$ python2.7 -c 'False = True; print False'

$ python3 -c 'False = True; print(False)'
  File "<string>", line 1
SyntaxError: assignment to keyword

 Ned Deily,
 nad at acm.org

More information about the Python-list mailing list