#8561: Implement PicklableFunction(interactive_function)
---------------------------+------------------------------------------------
Reporter: nthiery | Owner: was
Type: enhancement | Status: new
Priority: major | Milestone:
Component: pickling | Keywords: Pickling, lambda, interactively
defined functions
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------+------------------------------------------------
Extend sage.misc.fpickle.pyx with a PicklableFunction class wrapping
interactively defined (simple) functions to make them picklable:
{{{
sage: f = lambda x: x^2
sage: loads(dumps(f))
------------------------------------------------------------
Traceback (most recent call last):
File "<ipython console>", line 1, in <module>
File "sage_object.pyx", line 792, in
sage.structure.sage_object.dumps (sage/structure/sage_object.c:8357)
PicklingError: Can't pickle <type 'function'>: attribute lookup
__builtin__.function failed
sage: f = PicklableFunction(f)
sage: f(3)
9
sage: f == loads(dumps(f))
True
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8561>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.