dynamic object persistence

Lee Harr missive at frontiernet.net
Wed Jun 27 21:25:27 EDT 2001


This is what I am working on:

Python 2.1 (#1, Jun 24 2001, 00:39:38) 
[GCC 2.95.3 [FreeBSD] 20010315 (release)] on freebsd4
Type "copyright", "credits" or "license" for more information.
>>> import turtle
>>> t = turtle.Pen()
>>> def circle(self, r):
...     for deg in range(360):
...         self.forward(2*3.14*r/360.0)
...         self.right(1)
... 
>>> circle(t, 100)
>>> import new
>>> t.circle = new.instancemethod(circle, t, turtle.Pen)
>>> t.circle(110)
>>> 


now I want to save t. Is this possible? pickle and ZODB do not
seem to do what I want to do. Do I need to save the text of the
new method and dynamically construct a new subclass and save
that? Is this an active area of development?





More information about the Python-list mailing list