Passing Partial Lists into Python Function
<p>I'm writing a Python program to read in a text file and pull out some information.  There are three items I'm trying to find, one real number, and two lists.   The script stores the lines of the text file as a list <code>inLines</code>.  When reading through the lines the script uses <code>for curLine in inLines:</code> and then searches all of the lines for a specific key.  Once I find the search key I would like to pass the remaining portion of <code>inLines</code> into a function, read thorugh a few more lines, and then return to the main script at the line where the function left off.</p>

<p>Here's a little diagram of what I want to happen (code instructions given as comments)</p>

<pre><code>line of text that doesn't matter    #Read by main, nothing interesting happens
line of text that doesn't matter    #Read by main, nothing interesting happens
search key A                        #Read by main, all following lines passed to function A
line that matters                   #Read by function A, stores in object
line that matters                   #Read by function A, stores in object

line that matters                   #Read by function A, stores in object


search key B                        #Read by function A, return to main, all following lines passed to function B


line that matters                   #Read by function B, stores in object

search key C                        #Read by function B, return to main, all following lines passed to function C
line that matters                   #Red by function C, stores in object
</code></pre>

<p>So each search key tells the program which function to be in (and the different keys could be in any order).  When the script finds the key, it passes all further lines to the correct function, and whenever a function finds a search key, it breaks, and passes all further lines back to main (which then pass the same lines to the appropriate function)</p>

<p>Sorry for the book of a question, and I'm just learning Python after years of FORTRAN, so if anyone can think of a better way to go about this, I'm open to suggestions.  Thanks in advance</p>
