[Python-3000] PEP 3102 comments

Phillip J. Eby pje at telecommunity.com
Thu May 25 18:54:08 CEST 2006


At 11:42 AM 5/25/2006 +0200, Baptiste Carvello <baptiste13 at altern.org> wrote:
>maybe those use cases can work without syntactic sugar. With only part 1, you
>can already add a manual check if you need:
>
>  >>> def myfunction(a1, a2, *forbidden, kw1, kw2):
>...    assert forbidden is (), "myfunction() takes exactly 2 arguments"
>...    pass
>  >>>

How about:

     def myfunction(a1, a2, *(), kw1, kw2):

This seems to me to mean "an empty varargs parameter" on its face, and it 
has the advantage of being a valid call syntax.  That is, you can already 
invoke "myfunction(1,2,*())" and it's syntactically valid and means the 
same thing.



More information about the Python-3000 mailing list