Equivalent code to the bool() built-in function

candide candide at free.invalid
Sun Apr 17 10:38:08 CEST 2011

Le 17/04/2011 04:39, Ben Finney a écrit :

> Why do you need to know? (I should have asked that question earlier.)

First because I was doubting the true interest of the bool() type. In 
fact, it appears that it's _semantically_ a shortcut for
True if x else False. I could't imagine a builtin function having a so 
trivial implementation. Compare with float() or int(). I also try to 
consider how essential the bool() type is. Again compare with int() or 
str() types.

In the orther hand, I'm builting a sort of documentation for learning 
Python. In order to spell out the purposes of the bool() type, I guessed 
that giving an equivalence code could help.

More information about the Python-list mailing list