[redirecting back to list]
Ole Martin Bjørndalen wrote:
On Sun, Aug 5, 2012 at 4:09 PM, Ethan Furman <et...@stoneleaf.us> wrote:
Ole Martin Bjørndalen wrote:
You can do this by implementing either __getitem__ or __iter__, unless the
streaming flag would also make your table not in memory.
Cool!
Wow! I realize now that this could in fact be fairly easy to
implement. I just have to shuffle around the code a bit to make both
possible. The API would be:
# Returns table object which is a subclass of list
table = dbfget.read('cables.dbf')
for rec in table:
print rec
# Return a table object which behaves like an iterator
table = dbfget.read('cables.dbf', iter=True)
for rec in table:
print rec
I have a lot of questions in my mind about how to get this to work,
but I feel like it's the right thing to do. I will make an attempt at
a rewrite and get back to you all later.
One more API question: I am uncomfortable with:
dbfget.read()
Should it just be:
dbfget.get()
?
- Ole
`dbfget` is the package name, and `read()` or `get` is the
class/function that loads the table into memory and returns it?
Maybe `load()`?
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list