[Python-Dev] A thought on generic functions
Nick Coghlan
ncoghlan at gmail.com
Fri May 30 01:23:25 CEST 2008
Greg Ewing wrote:
> Nick Coghlan wrote:
>> I don't think it would actually be that much worse - something like
>> typetools.ProxyMixin would just involve a whole series of register
>> calls instead of method definitions. I wouldn't expect the total
>> amount of code involved to change much.
>
> I'm not thinking about the __xxx__ methods, they're an
> aberration. I'm thinking about all the user-defined
> methods and attributes that get caught in one go by
> the __getattr__ method of the proxy.
Ah, I see what you mean. That's where the generic system itself needs to
be based on generic functions - then you can hook the lookup function so
that proxies get looked up based on their target type rather than the
fact they're a proxy. It all gets very brain bending and self
referential, which is when folks tend to throw generics in the 'too
complicated' basket ;)
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-Dev
mailing list