On Wed, Mar 10, 2010 at 11:17 AM, D. Monarres <dmmonar...@gmail.com> wrote:
> Hello all,
>
> I am using a sage notebook interact to generate and display some
> random graphs  (more specifically a self-created extension of the
> graph class with extra properties) and would like to have the chance
> to save the output. Usually the notebook makes all defined variables
> global and I can specifically save certain results, but since I have
> defined my interact as a function all of the objects created seem to
> be local and disappear when the interact is finished. (other than for
> the graph output) I have tried to pickle the objects and save to a
> file but sage doesn't seem to allow me to pickle self defined classes.
> I was wondering if there was a standard way that people work around
> this. Thank you in advance for your help, sage is a wonderful piece of
> software.
>
> David Monarres

This is easy.  Just use the "global" keyword in Python.    Here's an example:

  http://sagenb.org/home/pub/1757/


William

>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to