Re: [Python-Dev] compatibility for C-accelerated types

2015年10月17日 15:39:54 -0700

On 18.10.15 01:20, Eric Snow wrote:
On the tracker he notes another OrderedDict compatibility break:
 Backward compatibility related to __class__ assignment was
 already broken in C implementation. In 3.4 following code
 works:
 >>> from collections import *
 >>> class foo(OrderedDict):
 ... def bark(self): return "spam"
 ...
 >>> class bar(OrderedDict):
 ... pass
 ...
 >>> od = bar()
 >>> od.__class__ = foo
 >>> od.bark()
 'spam'
 In 3.5 it doesn't.
Sorry, I was mistaken with this example. It works in 3.5.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to