[Python-3000] Type parameterization (was: Re: Type annotations: annotating generators)
Jim Jewett
jimjjewett at gmail.com
Fri May 19 21:54:44 CEST 2006
On 5/19/06, Collin Winter <collinw at gmail.com> wrote:
> ... what do you think of ... having bracket-based parameterization be
> redirected a call to some double-underscore method
It already is -- to __getitem__.
Having it go to something else just because you're in a function
definition is asking for trouble. What should happen in the following
case?
b=dict(strict=check1, lenient=check2, normal=check3)
def foo(a:b["normal"]): pass
Should it really look for some special method on b (or b's type) just
because it is in a signature context? Today, the annotation
expression would evaluate to check2, and I'm not looking forward to
figuring out all the corner cases on when that wouldn't happen.
-jJ
More information about the Python-3000
mailing list