function while true - list function?

Giles Constant giles at spacepigs.com
Tue Jul 24 10:00:19 EDT 2001


Hi there,

is there a function in python which will populate a list with the results 
of a function while the function returns something other than 'None'?  I've 
looked for something but can't find much, but it's something I'm doing so 
often (especially while processing SQL databases) that I'm wondering if, if 
it doesn't already exist, it could be a good idea for future versions.

eg:

def GrabSomeData:
        somecursor.execute("SELECT x,y FROM z")
        return unroll(somecursor.fetchone)   *

* I figured "unroll" would be a good name for it :-)




More information about the Python-list mailing list