Argument of the bool function

Ben Finney ben+python at benfinney.id.au
Fri Apr 8 17:57:48 EDT 2011


candide <candide at free.invalid> writes:

> Le 08/04/2011 18:43, Ian Kelly a écrit :

> > In "bool(x=5)", "x=5" is also not an expression. It's passing the
> > expression "5" in as the parameter x, using a keyword argument.
>
> You are probably right but how do you deduce this brilliant
> interpretation from the wording given in the documentation ?

By also learning the language syntax. ‘foo=bar’ within the parameters to
a function call will always mean binding a value to a keyword argument.

Just as the function docstring should not spend any space to explain
what the parens mean, it should not spend any space to explain how to
pass keyword arguments.

-- 
 \          “When [science] permits us to see the far side of some new |
  `\      horizon, we remember those who prepared the way – seeing for |
_o__)                          them also.” —Carl Sagan, _Cosmos_, 1980 |
Ben Finney



More information about the Python-list mailing list