Gregory Ewing <[email protected]>:
> You seem to be suggesting an optimisation that pre-creates bound
> methods when the instance is created. Keeping a cache of bound methods
> would achieve the same thing without changing the semantics. I think
> CPython might already be doing that, but I'm not sure.
No, I'm saying Python should behave differently.
Python:
>>> class A:
... def f(self):
... print("f")
... def g(self):
... print("g")
...
>>> a = A()
>>> a.__class__.f = a.__class__.g
>>> a.f()
g
In my preferred semantics, a.f() would print
>>> a.f()
f
Marko
--
https://mail.python.org/mailman/listinfo/python-list