On 5/19/06, Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> wrote:
> "Jim Jewett" <[EMAIL PROTECTED]> writes:
>
> > __getitem__ on a dictionary instance happens to be defined.
> > __getitem__ on the dict class happens not to be defined.
>
> I wouldn't be so sure.
>
> >>> dict.__getitem__
> <method '__getitem__' of 'dict' objects>
> >>> dict.__getitem__({'one':1}, 'one')
> 1

I should have been more precise.

On a dictionary instance, __getitem__ wil be found (in the definition
of the class dict)

On a type instance, such as dict itself, __getitem__ will not be found
(in the definition of the (meta)class type)

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.

-jJ
_______________________________________________
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

Reply via email to