Guido van Rossum wrote:
> On 5/20/06, Collin Winter <[EMAIL PROTECTED]> wrote:
>> 3. What will annotations on *varargs and **varkw look like? My own
>> suggestion is that
>>
>>>>> def foo(a: <type>, *varargs: <type>, **varkw: <type>)
>> is fully equivalent to -- and is indeed coerced to --
>>
>>>>> def foo(a: <type>, *varargs: list[<type>], **varkw: dict[str, <type>])
>> What did you have in mind?
> 
> We can't allow both the shorthand and the full notation, since then
> there would be ambiguity: if "*args: int" meant the same as "*args:
> list[int]", then what if I want each of the remaining positional
> arguments to be a list of ints? "*args: list[int]" is already taken to
> mean that each of the remaining arguments is an int.
> 
> Since the full notation is unnecessarily verbose, I propose that
> "*args: T" means that each of the remaining arguments should be a T,
> and the type of args itself is list[T]. Similar for **kwds.

That last paragraph is actually the way I interpreted Collin's suggestion (due 
to the "coerced to" comment).

And I trust "*args : T" would actually map to a type annotation of tuple[T] 
for the args variable ;)

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
_______________________________________________
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