[Python-3000] Type parameterization (was: Re: Type annotations: annotating generators)

Gareth McCaughan gmccaughan at synaptics-uk.com
Tue May 23 11:34:13 CEST 2006


On Saturday 2006-05-20 20:53, Guido van Rossum wrote:

> On 5/20/06, Tony Lownds <tony at printra.net> wrote:
> > How about just dict[str:int]?
> 
> A bit too clever, although it happens to work syntactically -- it
> calls dict.__getitem__(slice(str, int)).

Hmm. Why "too clever"? The symmetry with the syntax for dict literals
is nice, and (to me) it's more instantly apparent that the LH type
is the key and the RH type the value than with dict[str, int].

Now, Function[(int, int, int): float] isn't so good. ... Then again,
Function(int, int, int): float is pretty nice. What was the compelling
reason for not allowing bare slice literals, again? :-)

-- 
g



More information about the Python-3000 mailing list