I use a module that is part of the commercial software API. The good news is the python module - the bad news is that it's pretty fearless.
The following syntax is used to iterate through the lines:
cursor = gp.getcursor(table)
row = cursor.next()
while row:
row = cursor.next()
What is the most pythonic way to handle this situation? I looked at creating a first class function / generator and wrapping calls in a for loop:
def cursor_iterator(cursor):
row = cursor.next()
while row:
yield row
row = cursor.next()
[...]
cursor = gp.getcursor(table)
for row in cursor_iterator(cursor):
This is an improvement, but it feels a little awkward. Is there a more pythonic approach? Should I create a wrapper class around the type table?
fmark source
share