Argument Precedence (possible bug?)

Terry Reedy tjreedy at udel.edu
Mon Mar 6 15:24:37 EST 2006


"vbgunz" <vbgunz at gmail.com> wrote in message 
news:1141668470.191253.237600 at v46g2000cwv.googlegroups.com...
> Hello, Steven D'Aprano, Terry Jan Reedy!
>
> I would really like to extend my thanks to you guys. I hope I've got it
> right this time!
>
> def posKeyArgs(a, b=2, c=3):
>    print a, b, c
>
> #posKeyArgs(b=20)  # too few positional arguments. a needs an arg.

Yes, parameter a must get bound to something.
Any of pKA(10, b=20), pKA(a=10,b=20), pKA(c=30,a=5), etc, should work.

> #posKeyArgs(10, c=30, 20)  # pos_args cannot follow any kw_args.

Yes, this is an extreme of flexibility not allowed.

Terry Jan Reedy






More information about the Python-list mailing list