First time here? Check out the FAQ!

Ask Your Question
0

Creating Element Classes

asked 12 years ago

SLOtoSF gravatar image

updated 12 years ago

Hi! I want to be able to create elements, and want their parents to be elements, so I've been reading this page: http://www.sagemath.org/doc/reference....

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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 12 years ago

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 http://trac.sagemath.org/11490

Preview: (hide)
link

Comments

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 ( 12 years ago )

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 12 years ago

Seen: 766 times

Last updated: Sep 28 '12