Verbose and flexible args and kwargs syntax

Ian Kelly ian.g.kelly at gmail.com
Mon Dec 12 13:09:04 EST 2011


On Mon, Dec 12, 2011 at 5:21 AM, Eelco <hoogendoorn.eelco at gmail.com> wrote:
> You cannot; only constructors modelling a sequence or a dict, and
> only
> in that order. Is that rule clear enough?

The dict constructor can receive either a sequence or a mapping, so if
I write this:

        def func(a, b, dict(c)):

what will I get?  Probably I would want the equivalent of:

        def func(a, b, **c):

but you seem to be saying that I would actually get the equivalent of this:

        def func(a, b, *c):
            c = dict(c)

Cheers,
Ian



More information about the Python-list mailing list