Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26624
| Date | 2012-08-06 08:40 -0700 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: dbf.py API question |
| References | <501AA304.3090000@stoneleaf.us> <CAPz=1FSPc7cfxn+rbRWwo67SjOXV_DmOO=_R1tq2jLTkOXsntQ@mail.gmail.com> <501E7EA2.1060408@stoneleaf.us> <CAPz=1FRRvoKbT5D820GFnr2Z2F+URyszaB5QVtfiv6qv1Oh-ng@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3007.1344267373.4697.python-list@python.org> (permalink) |
[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~
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: dbf.py API question Ethan Furman <ethan@stoneleaf.us> - 2012-08-06 08:40 -0700
csiph-web