[Python-3000] Type parameterization (was: Re: Type annotations: annotating generators)
Nick Coghlan
ncoghlan at gmail.com
Sun May 21 03:07:10 CEST 2006
Jim Jewett wrote:
> On 5/19/06, Collin Winter <collinw at gmail.com> wrote:
>> B.__parameterize__ will only be called in the case of B[x] (as opposed
>> to B()[x]).
>
> new-style classes (the ones sticking around for python 3) are also instances.
>
> >>> isinstance(dict, type) and isinstance(dict, object)
> True
>
> How can the interpreter know which interpretation to use?
The same way the interpreter always resolves this question: type precedes
object in the MRO, so the methods of type win. This already happens with
__call__ - the idea is to extend it to __getitem__ as well.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list