[Python-3000] Cleaning up argument list parsing (was Re: Morewishful thinking)
Terry Reedy
tjreedy at udel.edu
Wed Apr 19 23:42:01 CEST 2006
"Guido van Rossum" <guido at python.org> wrote in message
news:ca471dc20604190650x39efc500p503807aa757c25a3 at mail.gmail.com...
> 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?
Terry Jan Reedy
More information about the Python-3000
mailing list