Argument of the bool function

candide candide at free.invalid
Fri Apr 8 18:59:59 EDT 2011


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():

dir([object])
[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 ?






More information about the Python-list mailing list