Built-in functions and keyword arguments

Hendrik van Rooyen mail at microcorp.co.za
Tue Oct 30 01:28:07 EDT 2007


"Jean-Paul Calderone" <exarkun at divmod.com> wrote:

> On Mon, 29 Oct 2007 19:03:34 +0200, Hendrik van Rooyen <mail at microcorp.co.za>
wrote:

> >Looks like a gotcha to me - its the difference between a keyword
> >(master = 42) and an assignment  (s='I am a string')
> >
>
> But it's not a keyword:
>
>   >>> len(s=[])
>   Traceback (most recent call last):
>     File "<stdin>", line 1, in ?
>   TypeError: len() takes no keyword arguments
>   >>>
>
> I think that's the issue here.

yes - the point I am trying to make is that the intention of the OP
was to use an assignment as an argument, and you can't do that,
as the interpreter thinks its a keyword.   Hence the gotcha.

- Hendrik




More information about the Python-list mailing list