Reid Kleckner <r...@mit.edu> added the comment: One thing I was wondering about the current patch is what about objects that have attributes that shadow methods? For example:
class C(object): def foo(self): return 1 c = c() print c.foo() c.foo = lambda: 2 print c.foo() Shouldn't the above print 1 and 2? With the current patch, it seems that you might still print 1. There's also the possible performance drawback where you're loading builtin C methods, so the optimization fails, but you end up calling _PyType_Lookup twice. :( I'm doing the same optimization for unladen swallow, and these were some of the things I ran into. I think I'm going to write a PyObject_GetMethod that tries to get a method without binding it, but if it can't for any reason, it behaves just like PyObject_GetAttr and sets a status code. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6033> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com