Equivalent code to the bool() built-in function
clp2 at rebertia.com
Sun Apr 17 02:16:47 CEST 2011
On Sat, Apr 16, 2011 at 4:51 PM, candide <candide at free.invalid> wrote:
> Le 16/04/2011 23:38, Ben Finney a écrit :
>> So the answer to the OP's question is no: the function isn't equivalent
>> to the type,
> Can bool() type and bool_equivalent() function return different values ?
No. The distinction being drawn is rather pedantic, IMO.
>> because the OP's ‘bool_equivalent’ function necessarily
>> uses the built-in ‘bool’ type, while the reverse is not true.
> The documentation doesn't seem to state it performs this call.
This is why I used the qualifiers "the equivalent of" and "conceptually".
> I'm referring to
> -- §5.10 Boolean operations in Document Reference Python 2.7
> -- bool()'s description in Library Reference
"bool([x]) Convert a value to a Boolean, using the standard truth
> -- §5.1 Truth Value Testing in Library Reference
This describes "the standard truth testing procedure". Ideally, this
section would be linked to in bool()'s docs.
More information about the Python-list