[mod_python] What can be pickled?

Nicolas Lehuen nicolas.lehuen at gmail.com
Thu Oct 20 06:29:01 EDT 2005


This means that they are not locally defined in a function or class.

In this example, foo is top-level whereas bar isn't :

# mymodule.py
def foo(y):
def bar(x):
return x+y
return bar

Just as an aside, I suppose you asking this question because you try to
store functions or classes in a session object. Just don't do this, this is
not supported and won't ever be. There are way too many problems due to the
interactions between dynamic module loading and pickling.


2005/10/20, Paul Hide <paul.hide at gmail.com>:
> Section 3.14.4 of the python language reference manual states:
> "These restrictions are why picklable functions and classes must be
> defined in the top level of a module."
> What does the phrase "top level" mean here?
> Paul Hide
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20051020/cb56cadb/attachment.html

More information about the Mod_python mailing list