Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26624 > unrolled thread

Re: dbf.py API question

Started byEthan Furman <ethan@stoneleaf.us>
First post2012-08-06 08:40 -0700
Last post2012-08-06 08:40 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: dbf.py API question Ethan Furman <ethan@stoneleaf.us> - 2012-08-06 08:40 -0700

#26624 — Re: dbf.py API question

FromEthan Furman <ethan@stoneleaf.us>
Date2012-08-06 08:40 -0700
SubjectRe: dbf.py API question
Message-ID<mailman.3007.1344267373.4697.python-list@python.org>
[redirecting back to list]

Ole Martin Bjørndalen wrote:
> On Sun, Aug 5, 2012 at 4:09 PM, Ethan Furman <ethan@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~

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web