Interesting Syntax: 'Bunch' class

Fredrik Lundh fredrik at pythonware.com
Mon Apr 9 03:06:51 EDT 2001


Andy Todd wrote:

> However, I'm puzzled by a bit of  syntax that I haven't seen before
> and can't find (easily) in the manual, viz;
>
> "    def __init__(self, **kwds):"
>
> What is the "**kwds" a reference to? All help greatfully received ...

where did you look?  the obvious place should be under
"function definitions" in the language reference:

    http://www.python.org/doc/current/ref/function.html

    ...

    "If the form *identifier is present, it is initialized to a
    tuple receiving any excess positional parameters, defaulting
    to the empty tuple. If the form **identifier is present, it is
    initialized to a new dictionary receiving any excess keyword
    arguments, defaulting to a new empty dictionary."

    ...

Cheers /F





More information about the Python-list mailing list