Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54567

Re: reload and work flow suggestions

From Terry Reedy <tjreedy@udel.edu>
Subject Re: reload and work flow suggestions
Date 2013-09-21 18:04 -0400
References <61d45045-187c-4be7-9da4-21a3124b753f@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.235.1379801106.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 9/21/2013 5:43 PM, Peter Cacioppi wrote:
> This is an idea brought over from another post.
>
> When I write Python code I generally have 2 or 3 windows open simultaneously.
>
> 1) An editor for the actual code.
> 2) The interactive interpreter.
> 3) An editor for the unit tests. (Sometimes skipped for quick one-off scripts)

At present, I use an Idle Shell and two editor windows.

> My work flow tends to involve using 2 to debug the issues that come up with 1 and 3. I'll write some new code in 1, play around with it in 2, then solidify the tests in 3. Or a test in 3 fails and I dig around with it using 2.

F5 in an editor window runs the code, puts the results in Shell, and 
leaves the objects loaded for interactive exploration in Shell.

> My problem is that I tend to use reload() quite a bit. I want to call functions and construct objects that are inside the guts of 1 and pass them arguments that are stored as variables in 2. If I restart my session for 2 I lose these variables (iPython does mitigate the pain here somewhat). Hence, I reload() modules into 2 when they are changed.

Since I work with files small enough to reload by rerunning, I have no 
use for reload().

> I use ipdb a lot in 2. I usually don't feel comfortable with virgin code or a debug fix that hasn't been stepped through with the debugger.

I trust tests, formal and informal, and use occasional print to debug.

> Is there something wrong with this work flow? I understand most python experts avoid reload(). So what are they doing that I'm not? I love the ability of Python to quickly let you dive deep into your code and set up a difficult case with 2, it's hard to imagine giving this up, and it's hard to imagine using it without reload().

Since 'experts do not use Idle', I must not be one ;-). I will let the 
real 'experts' explain what they do.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

reload and work flow suggestions Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-09-21 14:43 -0700
  Re: reload and work flow suggestions Terry Reedy <tjreedy@udel.edu> - 2013-09-21 18:04 -0400
  Re: reload and work flow suggestions Westley Martínez <anikom15@gmail.com> - 2013-09-21 21:01 -0700
  Re: reload and work flow suggestions rusi <rustompmody@gmail.com> - 2013-09-22 06:44 -0700
  Re: reload and work flow suggestions Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-09-23 01:31 -0700
    Re: reload and work flow suggestions rusi <rustompmody@gmail.com> - 2013-09-23 02:35 -0700
      Re: reload and work flow suggestions Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-09-23 11:40 +0100
  Re: reload and work flow suggestions Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-09-23 14:35 -0700

csiph-web