This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author danielsh
Recipients Arfrever, danielsh, einarfd, eli.bendersky, ezio.melotti, flox, georg.brandl, jcea, larry, python-dev, santoso.wijaya, skrah
Date 2013-01-01.23:11:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20130101231143.GC3402@lp-shahaf.local>
In-reply-to <>
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:48danielshsetrecipients: + danielsh, georg.brandl, jcea, larry, ezio.melotti, Arfrever, eli.bendersky, skrah, flox, santoso.wijaya, python-dev, einarfd
2013-01-01 23:11:48danielshlinkissue16076 messages
2013-01-01 23:11:48danielshcreate