On 03/02/2015 23:32, Marko Rauhamaa wrote:
Gregory Ewing <greg.ew...@canterbury.ac.nz>:

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

IMHO as clear as mud.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to