Ask Your Question
0

Where should I put a user defined function?

asked 12 years ago

Kushan.skm gravatar image

If I wrote a function and want it to be available in sage as a global function (not in a single worksheet), where should I put it ? I mean what directory within sage directory tree ?

Thanks.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 12 years ago

ndomes gravatar image

updated 12 years ago

Provided you have access to the Sage directory tree, you may put it in an appropriate subfolder of

sage-x.y/devel/sage/sage/

for example in

sage-x.y/devel/sage/sage/misc/

Let's say your file is named myfunctions.py, then

from sage.misc.myfunctions import *

will give you access to all functions defined in myfunctions.py

Preview: (hide)
link

Comments

No module named 'myfunctions'

Kushan.skm gravatar imageKushan.skm ( 12 years ago )

Do you think I should modify `sage-x.y/devel/sage/sage/misc/all.py` ?

Kushan.skm gravatar imageKushan.skm ( 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: 701 times

Last updated: Mar 16 '13