> didn't want to appear in the output. Wished I knew how to debug other than 
> just by using a lot of print statements.

When you need to get to the nitty gritty you need to use a realdebugger.

The best GUI one is probably the one in Pythonwin.
The standard one is PDB and the tutorial on it is OK.

I find the most useful approach is to set a breakpoint on the function
I'm interested in (or a control point within that - a loop or significant
branch say) then set a watch point on any variables I'm interested in.
Then step through the function remembering that 'step' will step into
any functions called by the function under test and 'next' will step
over the called functions, ie:

def foo():
   x = aFunction()
   x = another()
   return x

to step through foo will require 3 'next's but could involve dozens of
'steps' depending on how long 'aFunction' and 'another' are...

> 1) How to debug. I'm using v2.4, IDLE on Win XP.

IDLE's debugger isn't pretty but it does work, try it.
Use the context menus and mouse to set a break point,
then just step through using the step and next buttons.

IDLE debugger displays the variable values as you go...

If you can't get it to work you know where to ask for help :-)

Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld





> 2) I've tried to put in remarks that will help most anyone to understand 
> what the code is doing. Have I succeeded?
> 3) No modularization. Couldn't see a reason to do so. Is there one or two?
> Specifically, what sections should become modules, if any?
> 4) Variable names. I gave up on making them self-explanatory. Instead, I 
> put in some remarks near the top of the script (lines 6-10) that I hope do 
> the job. Do they? In the code, does the "L to newL to L to newL to L" kind 
> of thing remain puzzling?
>
> (lines 6-10)
> # meaning of short variable names:
> #   S is a string
> #   c is a character of a string
> #   L, F are lists
> #   e is an element of a list
>
> 5) Ideally, abbreviations that end in a period, such as U.N., e.g., i.e., 
> viz. op. cit., Mr. (Am. E.), etc., should not be stripped of their final 
> periods (whereas other words that end a sentence SHOULD be stripped). I 
> tried making and using a Python list of these, but it was too tough to 
> write the code to use it. Any ideas? (I can live very easily without a 
> solution to point 5, because if the output shows there are 10 "e.g"s, I'll 
> just assume, and I think safely, that there actually are 10 "e.g."s. But I 
> am curious, Pythonically.)
>
> Thanks very much in advance, tutors.
>
> Dick Moores
> [EMAIL PROTECTED]
>
>
>
>
> 

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to