dunder-docs (was Python is DOOMED! Again!)

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Feb 3 18:41:39 EST 2015


On 03/02/2015 23:32, Marko Rauhamaa wrote:
> Gregory Ewing <greg.ewing at 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




More information about the Python-list mailing list