[Python-Dev] PEP 457: Syntax For Positional-Only Parameters

Larry Hastings larry at hastings.org
Wed Oct 9 09:44:53 CEST 2013


On 10/09/2013 03:57 AM, Joao S. O. Bueno wrote:
> def a([b],/,**kw):
>     print (b)
>
> does calling "a(b=5)" should raise a TypeError, or put "5" in
> """kw["b"]""" and leave
> "b" as "undefined" ?

The latter.  This is how they are "similarly to *args and **kwargs":

     >>> def foo(*a, **kw):
    ...   print(a, kw)
    ...
     >>> foo(a=3, kw=5)
    () {'kw': 5, 'a': 3}
     >>>

//arry/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20131009/4d9b0b96/attachment.html>


More information about the Python-Dev mailing list