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

Talin talin at acm.org
Mon Apr 17 07:47:56 CEST 2006


Nick Coghlan <ncoghlan <at> gmail.com> writes:

> A question for Guido: Is this flexibility for argument passing only, or does 
> it apply to parameter declarations as well?

Actually, parameter declarations are what I am talking about. Now go back
and re-read the whole message with that in mind. :)

(Its probably my fault for using inaccurate terminology.)

However, we really ought to address both, which tells me that the prior
posting is only half the job. OK then...

As far as "too flexible", let's talk about that. On the definition side, you
don't want to see definitions that look like this:

   def func( first, second=default, third ):
      ...

In this case, I think your argument makes sense - what's the point of
supplying a default for the second parameter, but not the third?

And on the calling side:

   def func2( adama, valeri, thrace ):
     ...

   func2( valeri='cylon', 'human', 'human' )

In this case, however, I don't see why we can't have the keyword
arguments out of order. In the above example, the 'valeri' parameter
gets filled in first, and then the two remaining slots get filled in with
the positional argumens.

The important thing is that the behavior be clear and unambiguous,
which I think this is.

-- Talin




More information about the Python-3000 mailing list