On Dec 2, 7:58 pm, "Zac Burns" <[EMAIL PROTECTED]> wrote: > Sorry for the long subject. > > I'm trying to create a subclass dictionary that runs extra init code > on the first __getitem__ call. However, the performance of __getitem__ > is quite important - so I'm trying in the subclassed __getitem__ > method to first run some code and then patch in the original dict > method for the instance to avoid even the check to see if the init > code has been run. Various recipes using instancemethod and the like > have failed me.
For new-style classes, special methods are always looked up in the class, not the instance, so you're out of luck there. What are you trying to do? Perhaps there is a less magic solution to the general problem. George -- http://mail.python.org/mailman/listinfo/python-list