At 09:43 PM 5/14/2007 -0700, Guido van Rossum wrote:
>On 5/14/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote:
> > Or perhaps we could just say that if the main function is defined
> > with *args, we treat those arguments as positional?  i.e.:
> >
> >      @abstract
> >      def range(*args):
> >          """This just defines the signature; no implementation here"""
>
>That sounds about right.

After thinking about the implementation some more, I believe it'll be 
necessary to know *in advance* the maximum size of *args that will be 
used by any subsequent overload, in order to both generate the 
correct code for the main function (which must construct a fixed-size 
lookup tuple containing special values for not-supplied arguments), 
and the correct type tuples for individual overloads (which must 
contain similar special values for the to-be-omitted arguments).

So, if we could do something like this:

     @abstract
     def range(*args:3):
         ...

then that would be best.  I propose, therefore, that we require an 
integer annotation on the *args to enable positional dispatching.

If there are more *args at call time than this defined amount, only 
methods that have more positional arguments (or a *args) will be selected.

If the number is omitted (e.g. just *args with no annotation), the 
*args will not be used for method selection.

Still good?

_______________________________________________
Python-3000 mailing list
[email protected]
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