Chris Rebert <c...@rebertia.com> writes: > That is, `True if x else False` conceptually gets compiled down to > `True if bool(x) == 1 else False` (but without doing a run-time lookup > of "bool").
It won't look up the *name* ‘bool’, but it will use that object. Any boolean expression is going to be calling the built-in ‘bool’ type constructor. So the answer to the OP's question is no: the function isn't equivalent to the type, because the OP's ‘bool_equivalent’ function necessarily uses the built-in ‘bool’ type, while the reverse is not true. -- \ “Perchance you who pronounce my sentence are in greater fear | `\ than I who receive it.” —Giordano Bruno, burned at the stake by | _o__) the Catholic church for the heresy of heliocentrism, 1600-02-16 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list