Re: dbf.py API question

Discussion in 'Python' started by Ethan Furman, Aug 6, 2012.

  1. Ethan Furman

    Ethan Furman Guest

    [redirecting back to list]

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

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ethan Furman

    API design question for dbf.py

    Ethan Furman, Jul 6, 2012, in forum: Python
    Replies:
    0
    Views:
    154
    Ethan Furman
    Jul 6, 2012
  2. MRAB
    Replies:
    0
    Views:
    153
  3. Ethan Furman

    Re: API design question for dbf.py

    Ethan Furman, Jul 6, 2012, in forum: Python
    Replies:
    0
    Views:
    157
    Ethan Furman
    Jul 6, 2012
  4. Devin Jeanpierre

    Re: API design question for dbf.py

    Devin Jeanpierre, Jul 7, 2012, in forum: Python
    Replies:
    0
    Views:
    164
    Devin Jeanpierre
    Jul 7, 2012
  5. Ethan Furman

    Re: API design question for dbf.py

    Ethan Furman, Jul 7, 2012, in forum: Python
    Replies:
    0
    Views:
    152
    Ethan Furman
    Jul 7, 2012
Loading...

Share This Page