On Tue, Mar 31, 2009 at 1:26 PM, Henryk Trappmann
<bo198...@googlemail.com> wrote:
>
> On Mar 31, 4:35 pm, William Stein <wst...@gmail.com> wrote:
>> Note that callable objects are fine as
>> attributes (e.g., objects with a __call__ method defined).
>
> Actually I dont see how to get it to work:
> I want to give a function as initialization parameter to
> FormalPowerSeries.
> This function needs to be stored somewhere.
> If I store it inside a callable object then the callable object can
> not be pickled.
> I think the ability to give a function as parameter to
> FormalPowerSeries is a must.
> I dont want the user to declare a class that contains the function as
> __call__ method and then give an instance of this class as parameter
> to FormalPowerSeries (pickling would work in this case.)
>
> Can we circumvent this?

If the user gives a Python function, then the object they made cannot
be pickled.
If they give a Python object with a __call__ method, then the power
series *can* be pickled.
Just make sure that it can be when they give an appropriate input, and
give docstrings and documentation
to explain this subtle issue.

It's not a rule that every possible thing in Sage can be pickled --
e.g., open file handles can't be pickled.
However, I just want to make sure that if I want to make pickleable
power series and I jump through the hoop
of making the coefficient function a callable object that can be
pickled, then everything else works.  OK?

William

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

Reply via email to