On Wed, Feb 4, 2015 at 10:32 AM, Marko Rauhamaa <ma...@pacujo.net> wrote:
> 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

Yeeeouch. So either it has to actually copy everything in on
instantiation (stupid cost for the tiny chance that it'll actually
ever matter), or else have some kind of versioning that means that it
knows that 'a' was created from the pre-changed class.

What's the advantage?!?

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

Reply via email to