[Python-3000] Type parameterization

Nick Coghlan ncoghlan at gmail.com
Sun May 21 03:09:54 CEST 2006


Jim Jewett wrote:
> If the implementation of [] ends up doing the moral equivalent of
> 
>     (self.__getitem__(arg) if not isintance(self, type) else
> self.__parameterization__(arg))
> 
> then we're running into problems with
> 
>     If the implementation is hard to explain, it's a bad idea.

It's no more complicated than the difference between dict() and dict()(). The 
former works because it invokes type.__call__, the latter fails because it 
tries to invoke dict.__call__ (and fails to find it).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list