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

Collin Winter collinw at gmail.com
Fri May 19 23:09:42 CEST 2006


On 5/19/06, Guido van Rossum <guido at python.org> wrote:
> On 5/18/06, Collin Winter <collinw at gmail.com> wrote:
> > Use of positional arguments to parameterize dict, e.g., dict[str,
> > Number], is ugly, but keyword arguments would allow the prettier
> > dict[key=str, value=Number] (which might also be another use case for
> > the proposed keyword-only arguments).
>
> Maybe you didn't find all blog posts, or maybe I really didn't mention
> it, but I personally prefer dict[str, Number]. There really can't be
> much confusion over what these mean for anyone who knows what a dict
> is.

As a quick data point, I showed around your "dict[str, str|int]"
example to some friends, all of whom have done a decent amount of
coding in Python. I gave them some background, including that this was
an example of type parameterization. To quote one fellow, a PhD
student in CS at Edinburgh: "So, uh, 'dict[str, int|str]' is supposed
to represent... uh... I give in, what the hell is that supposed to
denote?"

I know the plural of "anecdote" isn't "data"; maybe c.l.p should be
polled on some of these things?

Collin Winter


More information about the Python-3000 mailing list