Ask Your Question

Importing user SAGE files "pythonically"

asked 2017-12-09 16:15:19 +0200

Vincent Russo gravatar image


I'm wondering if there's a more "pythonic" way in which to import user-written SAGE modules.

For instance, I'm able to load in a SAGE file I've written using the load keyword.


That's all well and good, however, as I start to import more and more user SAGE files, where certain functions are coming from becomes less clear. It would be ideal to do something like

from name_of_sage_file import name_of_sage_function

However, this doesn't seem to work. Is there a more "pythonic" way in which to go about doing this? Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-12-09 19:04:55 +0200

slelievre gravatar image

See the related Ask Sage question:

See also this template for packaging Sage code as a Python module:

See also these slides by Marc Masdeu about packaging Sage code as a Python module and distributing it:

edit flag offensive delete link more


Why-oh-why is this not more explicitly stated in the documentation. Thank you, good sir.

Vincent Russo gravatar imageVincent Russo ( 2017-12-10 01:09:37 +0200 )edit

Do you see a place in the documentation where this would fit well? Please suggest a change.

One way the documentation gets better is when this "why-oh-why" feeling makes users take action!

slelievre gravatar imageslelievre ( 2017-12-11 23:28:16 +0200 )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

1 follower


Asked: 2017-12-09 16:15:19 +0200

Seen: 657 times

Last updated: Dec 09 '17