On 4/19/06, Terry Reedy <[EMAIL PROTECTED]> wrote:
>
> "Guido van Rossum" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I once considered and rejected this syntax since another logical
> > interpretation would be that any positional arguments are accepted but
> > *ignored*.
>
> I was about to suggest that perhaps this is how it should be interpreted
> ;-).
>
> Perhaps it is too much to use syntax to indicate whether positional args
> should be silently ignored or raise an exception.  Given
>
> def f(*ignored, a, b='yes'): <body>
>
> positional args will be ignored if 'ignored' if never referenced again.  To
> raise an exception, just add
>
>   if ignored: raise TypeErrror("Positional args not allowed")
>
> Given that keyword only functions should be fairly rare (given that we have
> survived thus long without), is a syntactic abbreviation needed?

You're right. This currently doesn't work because *args must be last
(except for **kwds). but we're already considering an addition that
allows kwd=default following *args; an explicit check for args==() is
easy enough then.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to