pickle function reference ??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ted kelly

    pickle function reference ??

    It seems I can not deepcopy or pickle an object with an attribute that
    points to any function that is not a built in.
    I thought it should be ok as long as the function is defined in the top
    level of a module.
    What am I missing??
  • Martin v. Löwis

    #2
    Re: pickle function reference ??

    ted kelly <ted.kelly@comc ast.net> writes:
    [color=blue]
    > It seems I can not deepcopy or pickle an object with an attribute that
    > points to any function that is not a built in.[/color]

    That is not true

    import pickle

    class A:
    pass

    a=A()
    a.attr=pickle.l oads

    data=pickle.dum ps(a)
    b=pickle.loads( data)
    print b.attr

    works fine for me.

    Regards,
    Martin

    Comment

    Working...