Verbose and flexible args and kwargs syntax

Ian Kelly ian.g.kelly at gmail.com
Mon Dec 12 19:34:25 EST 2011


On Mon, Dec 12, 2011 at 11:51 AM, Eelco <hoogendoorn.eelco at gmail.com> wrote:
> Either way, its not hard to add some detail to the semantics to allow
> all this. Even this function definition:
>
> def func(Foo(args), Foo(kwargs))
>
> ...could even be defined unambigiously by overloading first on base
> type, and if that does not uniquely determine the args and kwargs,
> fall back on positionality, so that:
>
> def func(Foo(args), dict(kwargs))
> def func(list(args), Foo(kwargs))
>
> would be uniquely defined as well.

That solves some of the problems, but if I just have:

        def func(SequenceOrMappingType(args)):

That's going to unpack positionally.  If I want it to unpack keywords
instead, how would I change the definition to indicate that?



More information about the Python-list mailing list