Greg Reyna greyna at
Mon Jun 22 15:13:10 EDT 2009

Learning Python (on a Mac), with the massive help of Mark Lutz's 
excellent book, "Learning Python".

What I want to do is this:
I've got a Class Object that begins with a def.  It's designed to be 
fed a string that looks like this:

"scene 1, pnl 1, 3+8, pnl 2, 1+12, pnl 3, 12, pnl 4, 2+4,"

I'm parsing the string by finding the commas, and pulling out the 
data between them.
No problem so far (I think...)  The trouble is, there is a place 
where code is repeated:

1. Resetting the start & end position and finding the next comma in the string.

In my previous experience (with a non-OOP language), I could create a 
'procedure', which was a separate function.  With a call like: 
var=CallProcedure(arg1,arg2) the flow control would go to the 
procedure, run, then Return back to the main function.

In Python, when I create a second def in the same file as the first 
it receives a "undefined" error.  I can't figure out how to deal with 
this.  How do I set it up to have my function #1 call my function #2, 
and return?

The only programming experience I've had where I pretty much knew 
what I was doing was with ARexx on the Amiga, a language much like 
Python without the OOP part.  ARexx had a single-step debugger as 
part of the language installation.  I've always depended on a 
debugger to help me understand what I'm doing (eg Script Debugger for 
Apple Script--not that I understand Apple Script)  Python's debug 
system is largely confusing to me, but of course I'll keep at it.  I 
would love to see a step-by-step debugging tutorial designed for 
someone like me who usually wants to single-step through an entire 

Thanks for any help,
Greg Reyna

More information about the Python-list mailing list