top-level loops
Cameron Laird
claird at lairds.com
Wed Oct 8 18:22:35 EDT 2003
In article <mailman.1065649095.3003.python-list at python.org>,
Michael Chermside <mcherm at mcherm.com> wrote:
>Stefan writes:
>> I am writing a program (code included) and I would like to comment out
>> the two top-level loops and run the code that is under it regularly,
>> however, because the following code is not indented properly the
>> interpreter chokes. Is there a way around this?
>
>Well first of all, I prefer to use an editor which will allow me
>to indent or dedent entire blocks of code at a time. There are lots
>of others, but Idle (which almost certainly came with your copy of
>Python) is one... select the block then use tab or shift-tab.
>
>Also, in your case there's another quick work-around:
>
>
> #for i in range(0,3):
> # for j in range(0,3):
> for i in range(0,1):
> for j in range(0,1):
>
> ... rest of program goes here...
>
>
>Notice how I left in the for loops, but made sure that each
>occurred only once.
>
>-- Michael Chermside
>
>
Are you the kind of fellow who writes a lot of
if 1 or complicated_function():
other_stuff();
too, to the same end? I know *I* am ...
Stefan, if this really is a problem for you, it
suggests to me that it might be time for you to
define the body of the loop as an explicit
function, which you unit-test separately.
--
Cameron Laird <claird at phaseit.net>
Business: http://www.Phaseit.net
More information about the Python-list
mailing list