Procedures

Discussion in 'Python' started by Greg Reyna, Jun 22, 2009.

  1. Greg Reyna

    Greg Reyna Guest

    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
     
    Greg Reyna, Jun 22, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Taras
    Replies:
    2
    Views:
    4,814
    Rick Spiewak
    Oct 5, 2003
  2. Soumitra Banerjee

    Putting stored procedures in a dll

    Soumitra Banerjee, Feb 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    408
    Soumitra Banerjee
    Feb 27, 2004
  3. lhak
    Replies:
    1
    Views:
    5,445
    √Čric Moreau [VB MVP]
    Oct 23, 2004
  4. Michel Bieleveld

    using procedures

    Michel Bieleveld, Aug 12, 2004, in forum: VHDL
    Replies:
    17
    Views:
    965
    Jeroen
    Aug 14, 2004
  5. Peter Hermansson

    Procedures in testbench confusion

    Peter Hermansson, Aug 25, 2004, in forum: VHDL
    Replies:
    2
    Views:
    867
    Peter Hermansson
    Aug 25, 2004
Loading...

Share This Page