mem.memoize error

5 views
Skip to first unread message

Friedrich Hagedorn

unread,
Feb 3, 2010, 5:24:35 AM2/3/10
to mem-...@googlegroups.com
Hello,

I just want to try out the example from your doc (mem.rst), but I get
an error with the last git commit:

~/tmp/mem$ ipython
Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.1 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import mem

In [2]: @mem.memoize
...: def hey(name):
...: return 'Hallo, %s' % name
...:

In [3]: hey
Out[3]: <function f at 0xb78e3e9c>

In [4]: hey('Fritz')
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'> Traceback (most recent call
last)

/usr/users/frstud/s3200857/tmp/mem/<ipython console> in <module>()

/usr/users/frstud/s3200857/tmp/mem/mem/__init__.py in f(*args, **kwargs)
47 def memoize(taskf):
48 def f(*args, **kwargs):
---> 49 mem = Mem.instance()
50 if mem is None:
51 raise RuntimeError("Mem Singleton has not yet been
created")

/usr/users/frstud/s3200857/tmp/mem/mem/_mem.py in instance(cls)
96 @classmethod
97 def instance(cls):
---> 98 return cls.__it__
99
100 def init(self, *args, **kwds):

<type 'exceptions.AttributeError'>: type object 'Mem' has no attribute
'__it__'

Do you know what is the problem?

Thanks,

Friedrich


PS.: My idea is to use mem for caching the results from numerical
simulations.

Reply all
Reply to author
Forward
0 new messages