On 5/19/06, Jim Jewett <[EMAIL PROTECTED]> wrote: > On 5/19/06, Collin Winter <[EMAIL PROTECTED]> 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.
dict(normal=check3)["normal"] is not the same as dict["normal"] -- Guido and I have been discussing the latter. When I said "redirected", I meant that dict's metaclass would catch the __getitem__ call and then invoke dict.__parameterize__() appropriately. Collin Winter _______________________________________________ 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
