Ask Your Question

Creating Element Classes

asked 2012-09-27 18:36:08 -0500

SLOtoSF gravatar image

updated 2012-09-27 18:36:48 -0500

Hi! I want to be able to create elements, and want their parents to be elements, so I've been reading this page:

The example shows Cython commands it seems (cdef v def).... Why? Couldn't I just do this in Python?

Excerpt from page cited above.

Elements typically define a method _new_c, e.g.,

cdef _new_c(self, defining data): cdef FreeModuleElement_generic_dense x x = PY_NEW(FreeModuleElement_generic_dense) x._parent = self._parent x._entries = v

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2012-09-27 22:42:47 -0500

Volker Braun gravatar image

Elements can be implemented in plain Python and in Cython. Often, Cython is used for speed but you don't have to.

You should have a look at the worksheet on

edit flag offensive delete link more


Wonderful. I had no idea that there were these educational worksheets about Sage development. Is there a general repository for them? (I've posted this as a different question). Thanks!

SLOtoSF gravatar imageSLOtoSF ( 2012-09-27 23:00:10 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-09-27 18:36:08 -0500

Seen: 74 times

Last updated: Sep 27 '12