Is there a way to use lazy_attribute in cython code? An example code is
this:
from sage.misc.lazy_attribute import lazy_attribute
cdef class A:
def __init__(self):
pass
@lazy_attribute
def a(self):
return 1
It results in an error:
sage:
Compiling /home/punarbasu/tmp/a.spyx...
sage: aa = A()
sage: aa.a
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/punarbasu/tmp/<ipython console> in <module>()
/home/punarbasu/Installations/sage-5.0.beta2/local/lib/python2.7/site-
packages/sage/misc/lazy_attribute.pyc in __get__(self, a, cls)
544 return getattr(super(cls, a),self.f.__name__)
545 try:
--> 546 setattr(a, self.f.__name__, result)
547 except AttributeError:
548 if CM is not None:
AttributeError: '_home_punarbasu_tmp_a_spyx_6.A' object attribute 'a' isread
-only
--
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-support
URL: http://www.sagemath.org