Hi Jeroen,
On 2016-04-14, Jeroen Demeyer <[email protected]> wrote:
> On 2016-04-14 00:00, Simon King wrote:
>> If I understand correctly, such a decorator would not work in Cython code.
>
> Why not? Cython supports decorators.
I occasionally got errors telling me that Cython does not support
arbitrary decorators. Let's try:
sage: cython("""
....: from sage.misc.cachefunc import cached_method
....: cdef class Foo:
....: @cached_method
....: def bar(self):
....: return 5
....: """)
Hum. I thought that used to give me errors.
Aha! Now I recall:
sage: cython("""
....: from sage.misc.cachefunc import cached_method
....: cdef class Foo:
....: @cached_method
....: cpdef bar(self):
....: return 5
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line string', (1, 0))
...
_home_king__sage_temp_king_C70_B_2080_tmp_tdV8lC_spyx_0.pyx:9:4: Cdef
functions/classes cannot take arbitrary decorators.
""")
So, it won't work for cpdef methods.
Best regards,
Simon
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.