[wplug] Python code development

Matthew Zwier mczwier at gmail.com
Fri Nov 22 11:35:56 EST 2013


The ipython notebook is absolutely phenomenal for this.


On Fri, Nov 22, 2013 at 10:06 AM, Bruce Adams <bruce.adams at acm.org> wrote:

> Will Python's built-in "reload" do what you want?
>
>
> http://stackoverflow.com/questions/684171/how-to-re-import-an-updated-package-while-in-python-interpreter
>
> - Bruce
>
> On Fri, Nov 22, 2013, at 10:57 AM, Mike Sussman wrote:
> > Thank you for your response, Rod, but I am asking a MUCH simpler
> > question than the one you answered.
> >
> > I am not trying to use Matlab code inside python or anything, I am just
> > trying to transfer my comfortable and efficient approach to code
> > development from Matlab to python.
> >
> > When I am using Matlab, I have an editor and the interpreter up in
> > different windows (I use various flavors of Linux).  The editor contains
> > a partially-competed version of some code.  I execute it in the Matlab
> > interpreter by typing the name of the file.  Then I can examine the
> > results in the interpreter and try writing a few more lines in the
> > interpreter.  When I am happy with them, I copy them to the file and do
> > it all again for more new code.
> >
> > If I bring up the python interpreter and import an existing file, I can
> > check results in the interpreter and write new code, and copy it to the
> > file.  BUT I cannot import that file again, so I must exit the python
> > interpreter (ctrl-D) and start the interpreter again from the command
> > line.  Is there a better way to do that?
> >
> > On 11/22/2013 10:18 AM, Rod Person wrote:
> > > On 11/22/2013 10:04 AM, Mike Sussman wrote:
> > >> I am an experienced Matlab programmer and am beginning to use python
> for
> > >> some scientific applications.  My question is how python programmers
> do
> > >> their work.
> > >>
> > >> When I develop new code in Matlab, I have the editor open and, as I
> > >> add to
> > >> the code, I can quickly test the new additions with a single command
> > >> that
> > >> re-reads my file and tests the new code.  I do not know how to do the
> > >> same
> > >> thing in python.  If I am writing a new .py file, I either have to
> > >> import
> > >> it or I have to exit python and start python again.  Either of these
> > >> seems
> > >> to take a few annoying seconds longer than I would like to wait.  Is
> > >> there
> > >> a better strategy?
> > >>
> > >> -----------------------
> > >> Mike Sussman
> > >
> > > I'm not sure what you mean by "exit python and start again", unless
> > > you are making changes to python itself or possibly CGI programming,
> > > but I'm not familiar with making Matlab code with Python.
> > >
> > > Anyway in a *nix environment, I use FreeBSD, I usually have a 2nd
> > > terminal open that I can run the make script of the python code on
> > > working on if needed. This is if I'm using an editor such as geany.
> > >
> > > If I'm using Sypder or Komodo IDE, they both allow for the running and
> > > debugging of Python code directly.
> > >
> > >
> >
> >
> >
> >
> > --
> > Mike Sussman
> > _______________________________________________
> > wplug mailing list
> > wplug at wplug.org
> > http://www.wplug.org/mailman/listinfo/wplug
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>


More information about the wplug mailing list