[IPython-user] can't pickle interactively defined function

Robin robince@gmail....
Mon Oct 27 12:43:35 CDT 2008

On Mon, Oct 27, 2008 at 5:19 PM, Robert Kern <robert.kern@gmail.com> wrote
> We're not putting things defined in the namespace in the __main__ module. I'm
> not sure what the best approach should be, here. There might be multiple
> namespaces floating around. Presumably, they shouldn't all be linked to __main__.

Thanks for looking into it...

I'm a bit out of my depth with this stuff - from Googling the __main__
module in Ipython is actually a FakeModule - whether or not this is
designed to contain interactively designed stuff I'm not sure.

In [185]: __main__?
Type:           FakeModule
Base Class:     <class 'IPython.FakeModule.FakeModule'>
String Form:    <module '__main__' from
Namespace:      Interactive
    Simple class with attribute access to fake a module.

    This is not meant to replace a module, but to allow inserting a fake
    module in sys.modules so that systems which rely on run-time module
    importing (like shelve and pickle) work correctly in interactive IPython

    Do NOT use this code for anything other than this IPython private hack.


More information about the IPython-user mailing list