[Python-Dev] The memo of pickle

Martin v. Loewis martin@v.loewis.de
07 Aug 2002 00:30:18 +0200

"M.-A. Lemburg" <mal@lemburg.com> writes:

> >>Sure. I use pickle subclasses with hooks for various special
> >> object types a lot in my applications...
> > Can you provide the source of one such subclass?
> No, they are closed-source. But the idea should be obvious:
> I want to pickle the various mx types faster then by
> relying on the reduce mechanism.

Ok. I think I could making this change without breaking your code:
Subclasses won't read the memo; they will only write to it -
Pickler.save is the only place that ever reads the memo.

So subclasses could safely put tuples into the dictionary; the base
class would then look for either tuples or numbers.