Message192813
The dictionary and the set do not give the freedom to add dynamic attributes to them. I agree that the Counter should have the same behaviour.
However, this will raise the same bug when we inherit from a Counter object.
>>> class mylist(list): pass
...
>>> l = mylist()
>>> l.foo = "bar"
>>> c = copy.deepcopy(l)
>>> print(c.foo) # prints bar
>>> class myCounter(Counter): pass
...
>>> original = myCounter()
>>> original.foo = "bar"
>>> c = copy.deepcopy(original)
>>> c.foo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'myCounter' object has no attribute 'foo'
The reduction function should still copy every dynamic attribute of the object. |
|
Date |
User |
Action |
Args |
2013-07-10 14:28:35 | Olivier.Gagnon | set | recipients:
+ Olivier.Gagnon, rhettinger, eric.snow, serhiy.storchaka, madison.may, vajrasky |
2013-07-10 14:28:35 | Olivier.Gagnon | set | messageid: <1373466515.3.0.121712462561.issue18352@psf.upfronthosting.co.za> |
2013-07-10 14:28:35 | Olivier.Gagnon | link | issue18352 messages |
2013-07-10 14:28:35 | Olivier.Gagnon | create | |
|