[sage-devel] Re: Status of @lazy_attribute for cdef classes

2017-08-25 Thread Simon King
Hi Jeroen, On 2017-08-25, Jeroen Demeyer wrote: > On 2017-08-25 13:37, Simon King wrote: >> Not much, actually: > > My point was that a __dict__ makes any attribute access slower, not just > this lazy attribute. It will also seriously slow down cpdef methods. OK, if it

Re: [sage-devel] Re: Status of @lazy_attribute for cdef classes

2017-08-25 Thread Jeroen Demeyer
On 2017-08-25 13:37, Simon King wrote: Not much, actually: My point was that a __dict__ makes any attribute access slower, not just this lazy attribute. It will also seriously slow down cpdef methods. -- You received this message because you are subscribed to the Google Groups "sage-devel"

[sage-devel] Re: Status of @lazy_attribute for cdef classes

2017-08-25 Thread Simon King
Hi Jeroen, On 2017-08-25, Jeroen Demeyer wrote: > One workaround is adding a __dict__: > ... > This does make everything slower though, so I guess it's not what you want. Not much, actually: sage: cython(""" : from sage.structure.element cimport Element : cdef

Re: [sage-devel] Re: Status of @lazy_attribute for cdef classes

2017-08-25 Thread Jeroen Demeyer
On 2017-08-25 13:07, Simon King wrote: Hi! I just realise that @property works for Cython, and it is competitive! Indeed. Cython has optimized code to deal with standard decorators like @staticmethod, @classmethod and @property. The reason that lazy_import does not work for Cython classes

[sage-devel] Re: Status of @lazy_attribute for cdef classes

2017-08-25 Thread Simon King
Hi! I just realise that @property works for Cython, and it is competitive! Namely: sage: cython(""" : from sage.structure.element cimport Element : cdef class CyElement(Element): : cdef object _test : def __init__(self, P): : Element.__init__(self,P) :