Message178783
Eli Bendersky wrote on Tue, Jan 01, 2013 at 00:32:51 +0000:
> 1. Why did you choose to implement __reduce__ and not __getstate__?
Maybe I was simply imitating what some other extension module was doing ;)
By using __reduce__ with the type as first return value, the
__setstate__ code becomes simpler because it doesn't need to address
'tag' and 'attrib'. This consideration is somewhat moot now that the
unpickle-Python-pickled-Element's code path has to think about all
instance attributes, including those settable by the constructor.
> 2. A lot of code appears to be shared between
> element_setstate_from_attributes and the init method implementation,
> can it be refactored?
It seems there might be room for code reuse --- both functions set
tag,text,tail,attrib (but the unpickler sets the children too). I'll
look into that in the next iteration (once the class name and pickle
output format issues are settled). |
|
Date |
User |
Action |
Args |
2013-01-01 23:11:48 | danielsh | set | recipients:
+ danielsh, georg.brandl, jcea, larry, ezio.melotti, Arfrever, eli.bendersky, skrah, flox, santoso.wijaya, python-dev, einarfd |
2013-01-01 23:11:48 | danielsh | link | issue16076 messages |
2013-01-01 23:11:48 | danielsh | create | |
|