[Python-Dev] adding save() and load() function for interactive use (original) (raw)

Gerrit Holl gerrit at nl.linux.org
Mon Dec 1 14:30:55 EST 2003


Phillip J. Eby wrote:

At 07:30 PM 12/1/03 +0100, Gerrit Holl wrote: >save() is easily implemented by pickling > locals(); load() is easily implemented by updating > locals() while unpickling it.

Functions and classes are pickled as references to a module, so this wouldn't actually work. When you try to load(), the unpickling will fail if the function or class doesn't already exist in the module.

Ouch. Of course... I should have thought it through better... sorry!

yours, Gerrit.

-- 219. If a physician make a large incision in the slave of a freed man, and kill him, he shall replace the slave with another slave. -- 1780 BC, Hammurabi, Code of Law

Asperger's Syndrome - a personal approach: http://people.nl.linux.org/~gerrit/english/



More information about the Python-Dev mailing list