ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 30 Apr 2011 15:15:13 +0200Sage relation to Pythonhttps://ask.sagemath.org/question/8045/sage-relation-to-python/Bear with me here..
I'm still struggling to use regular Python with Idle Ipython and the like.. And also Sage.
What I'm not real clear on is if I can treat Sage Notebook as another Python Development environment?
If so how do I save and recall, execute and edit plain .py files in Sage.. I've probably just missed it?Sat, 30 Apr 2011 02:35:54 +0200https://ask.sagemath.org/question/8045/sage-relation-to-python/Answer by Felix Lawrence for <p>Bear with me here..
I'm still struggling to use regular Python with Idle Ipython and the like.. And also Sage.</p>
<p>What I'm not real clear on is if I can treat Sage Notebook as another Python Development environment?</p>
<p>If so how do I save and recall, execute and edit plain .py files in Sage.. I've probably just missed it?</p>
https://ask.sagemath.org/question/8045/sage-relation-to-python/?answer=12328#post-id-12328The Sage notebook doesn't replace a good text editor. It's fantastic for writing 'on the fly' code and for calling pre-written functions, but as far as I know, there's no handy GUI in the notebook for opening, manually editing and saving `.py` files.
There is, however, very neat support for executing `.py` and `.sage` files. The `load` and `attach` commands are [explained](http://sagemath.org/doc/tutorial/programming.html#loading-and-attaching-sage-files) in the tutorial and work both for `.sage` files and for `.py` files. `attach` will automatically reload the file every time it is changed. The preparser is not called for `.py` files, so you have to import any sage functions that you want to use.
You can set the path for `load` and `attach` using `load_attach_path`.Sat, 30 Apr 2011 05:54:27 +0200https://ask.sagemath.org/question/8045/sage-relation-to-python/?answer=12328#post-id-12328Comment by dartdog for <p>The Sage notebook doesn't replace a good text editor. It's fantastic for writing 'on the fly' code and for calling pre-written functions, but as far as I know, there's no handy GUI in the notebook for opening, manually editing and saving <code>.py</code> files.</p>
<p>There is, however, very neat support for executing <code>.py</code> and <code>.sage</code> files. The <code>load</code> and <code>attach</code> commands are <a href="http://sagemath.org/doc/tutorial/programming.html#loading-and-attaching-sage-files">explained</a> in the tutorial and work both for <code>.sage</code> files and for <code>.py</code> files. <code>attach</code> will automatically reload the file every time it is changed. The preparser is not called for <code>.py</code> files, so you have to import any sage functions that you want to use.</p>
<p>You can set the path for <code>load</code> and <code>attach</code> using <code>load_attach_path</code>.</p>
https://ask.sagemath.org/question/8045/sage-relation-to-python/?comment=21770#post-id-21770That helps a lot. It fills in a few missing pieces for me! So it seems that I could have Vim open side by side and use Sage as the execution environment, much like I'm doing with Ipython now...Sat, 30 Apr 2011 12:46:36 +0200https://ask.sagemath.org/question/8045/sage-relation-to-python/?comment=21770#post-id-21770Comment by cswiercz for <p>The Sage notebook doesn't replace a good text editor. It's fantastic for writing 'on the fly' code and for calling pre-written functions, but as far as I know, there's no handy GUI in the notebook for opening, manually editing and saving <code>.py</code> files.</p>
<p>There is, however, very neat support for executing <code>.py</code> and <code>.sage</code> files. The <code>load</code> and <code>attach</code> commands are <a href="http://sagemath.org/doc/tutorial/programming.html#loading-and-attaching-sage-files">explained</a> in the tutorial and work both for <code>.sage</code> files and for <code>.py</code> files. <code>attach</code> will automatically reload the file every time it is changed. The preparser is not called for <code>.py</code> files, so you have to import any sage functions that you want to use.</p>
<p>You can set the path for <code>load</code> and <code>attach</code> using <code>load_attach_path</code>.</p>
https://ask.sagemath.org/question/8045/sage-relation-to-python/?comment=21769#post-id-21769I find that the Sage Notebook is an excellent environment for experimenting with code and for building a feature or fixing a bug. Once I've worked out the kinks I then turn to implementing my results in a Python file or by creating a patch. The Notebooks is mighty convenient for experimentation!Sat, 30 Apr 2011 15:15:13 +0200https://ask.sagemath.org/question/8045/sage-relation-to-python/?comment=21769#post-id-21769