[Python-3000] Cleaning up argument list parsing (was Re: Morewishful thinking)

Ian Bicking ianb at colorstudy.com
Wed Apr 19 23:54:26 CEST 2006


Terry Reedy wrote:
> Given that keyword only functions should be fairly rare (given that we have 
> survived thus long without), is a syntactic abbreviation needed?

It's quite common to see documentation warn API users only to call a 
function with keyword arguments, so there's definitely a desire.  But 
certainly with the already-agreed-upon keywords-after-*args it would be 
easy to implement this with one assert, where now it is quite tedious.

I don't know if there's an advantage to presenting a signature that 
accurately describes the function; it can never *really* be accurate in 
all cases, as there can be all sorts of constraints that are impossible 
to represent in the signature (like mutually exclusive keyword 
arguments).  But then by putting in *args to constrain arguments to 
keywords, you formally represent the keyword constraint while adding a 
very inaccurate representation of the function signature for positional 
arguments.

-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org


More information about the Python-3000 mailing list