Message82692
| Author |
pitrou |
| Recipients |
alexandre.vassalotti, collinwinter, ggenellina, jakemcguire, jcea, jyasskin, pitrou |
| Date |
2009年02月25日.02:11:35 |
| SpamBayes Score |
0.0032484403 |
| Marked as misclassified |
No |
| Message-id |
<1235527897.82.0.442250454679.issue5084@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
To give an example of what the test could check:
>>> class C(object):
... def __init__(self):
... self.some_long_attribute_name = 5
...
>>> c = C()
>>> c.__dict__
{'some_long_attribute_name': 5}
>>> sorted(map(id, c.__dict__))
[140371243499696]
>>> import pickle
>>> d = pickle.loads(pickle.dumps(c, -1))
>>> d
<__main__.C object at 0x7faaba1b0390>
>>> d.__dict__
{'some_long_attribute_name': 5}
>>> sorted(map(id, d.__dict__))
[140371243501232]
The `sorted(map(id, d.__dict__))` should have been the same before and
after pickling. |
|