By default, shelve uses pickle to serialize objects.Pickle doesn't
actually serialize functions... it just saves the function's name and
name of its defining module, and upon loading attempts to find that
function again. This is pretty much /never/ going to work the way you
want it to if you'r
Michele, thank you for the suggestion, it works as you mention.
But in my case the function is inside a string and I should exec the
string to get the function. Something like this
>>> fields = {}
>>> s = 'def f(): pass'
>>> exec s in fields
>>> f = fields['f']
>>> f
>>> import shelve
>>> d = sh
The simple way is to use shelve:
$ ipython
Python 2.4.1c2 (#2, Mar 19 2005, 01:04:19)
Type "copyright", "credits" or "license" for more information.
IPython 0.6.5 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % fun