Argument of the bool function
robert.kern at gmail.com
Sun Apr 10 01:22:57 CEST 2011
On 2011-04-08 17:59 , candide wrote:
> Le 09/04/2011 00:03, Ethan Furman a écrit :
>> > bool([x])
>> > Convert a value to a Boolean, using the standard truth testing
>> > procedure.
>> As you can see, the parameter name is 'x'.
> OK, your response is clarifying my point ;)
> I didn't realize that in the bool([x]) syntax, identifier x refers to a
> "genuine" argument [I was considering x as referring to a "generic" object
> having a boolean value].
> Nevertheless, compare with the definition the doc provides for the builtin
> function dir():
> [definition omited, just observe the declaration syntax]
> Now, lets make a try
> >>> dir(object="Explicit is better than implicit")
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: dir() takes no keyword arguments
> Not very meaningful, isn't it ?
No one is saying that every instance of "foo([arg])" in the docs means that the
given argument is named such that it is available for keyword arguments. What
people are saying is that for bool(), *that happens to be the case*.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list