Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Procedures

Reply
Thread Tools

Procedures

 
 
Greg Reyna
Guest
Posts: n/a
 
      06-22-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
script.

Thanks for any help,
Greg Reyna

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugging SQL Server 2000 Stored Procedures. lhak ASP .Net 1 10-23-2004 03:30 PM
Procedures in testbench confusion Peter Hermansson VHDL 2 08-25-2004 02:15 PM
using procedures Michel Bieleveld VHDL 17 08-14-2004 01:45 PM
Putting stored procedures in a dll Soumitra Banerjee ASP .Net 1 02-27-2004 01:46 AM
VB.NET Retrieving Identity form MSSQL2000 without using stored procedures Taras ASP .Net 2 10-05-2003 05:35 AM



Advertisments