Implementation of Book Organization tool (Python2.[x])

Discussion in 'Python' started by ~km, Nov 23, 2009.

  1. ~km

    ~km Guest

    Hi together,

    I'm a python-proficient newbie and want to tackle a program with
    Python 2.x, which basically organizes all my digital books (*.pdf,
    *.chm, etc..) and to give them specific "labels", such as:

    "Author" -> string
    "Read" -> boolean
    "Last Opened:" -> string
    and so on..

    Now my question is:

    Is it a better method to use a /database/, a /static File/, with some
    Markup (e.g.: YAML, XML), a Python dictionary or are there better ways
    I
    don't know of.., for organizing my books collection? I'm sure you can
    do
    it in any way above, but I'm apelling to /your/ personal experience
    and
    preference. Please give me at least one reason, why.
    ---
    I think we are in Rats' Alley where the dead men lost their bones.
    -- T.S. Eliot
     
    ~km, Nov 23, 2009
    #1
    1. Advertising

  2. ~km

    Lie Ryan Guest

    ~km wrote:
    > Hi together,
    >
    > I'm a python-proficient newbie and want to tackle a program with
    > Python 2.x, which basically organizes all my digital books (*.pdf,
    > *.chm, etc..) and to give them specific "labels", such as:
    >
    > "Author" -> string
    > "Read" -> boolean
    > "Last Opened:" -> string
    > and so on..
    >
    > Now my question is:
    >
    > Is it a better method to use a /database/, a /static File/, with some
    > Markup (e.g.: YAML, XML), a Python dictionary or are there better ways


    In high-volume systems, it is almost always better to use a database.
    Database solves many issues with concurrent access and persistent memory.

    Though many would disagree, I consider XML as a form of database though
    it is only suitable for data exchange. XML is suitable for low- to
    medium-volume purpose and when compatibility with various systems is
    extremely important (nearly any OS and any programming language has XML
    parsers; porting a DBMS system may not be as easy as that).

    Python dictionary is stored in memory and closing the program ==
    deleting the database. You can pickle dictionary; and this might be
    sufficient for quick and dirty, low-volume purpose. Pickled dictionary
    is the least portable solution; only python program can open a pickled
    dictionary and even different versions of python may have incompatibilities.

    > I
    > don't know of.., for organizing my books collection? I'm sure you can
    > do
    > it in any way above, but I'm apelling to /your/ personal experience
    > and
    > preference. Please give me at least one reason, why.


    For a personal book collection where the number of books is around ~300
    books and you don't care about porting to another system, pickled
    dictionary may be just good enough.
     
    Lie Ryan, Nov 23, 2009
    #2
    1. Advertising

  3. ~km

    Steve Howell Guest

    On Nov 22, 6:06 pm, "~km" <> wrote:
    > Hi together,
    >
    > I'm a python-proficient newbie and want to tackle a program with
    > Python 2.x, which basically organizes all my digital books (*.pdf,
    > *.chm, etc..) and to give them specific "labels", such as:
    >
    > "Author" -> string
    > "Read" -> boolean
    > "Last Opened:" -> string
    > and so on..
    >
    > Now my question is:
    >
    > Is it a better method to use a /database/, a /static File/, with some
    > Markup (e.g.: YAML, XML), a Python dictionary or are there better ways
    > I
    > don't know of.., for organizing my books collection? I'm sure you can
    > do
    > it in any way above, but I'm apelling to /your/ personal experience
    > and
    > preference. Please give me at least one reason, why.


    If your data structure is just a list of dictionaries and you do not
    have any performance/security issues to consider yet, then you can use
    pure Python for your input, since it is pretty easy to hand-edit, and
    then occasionally you could use the PrettyPrinter module to format
    your data. YAML is another option, as it can offer a slightly cleaner
    syntax, but I do not think it buys you a whole lot more than that for
    your use case. Same for JSON--I like JSON but you do not need it
    right away.

    PrettyPrinter is batteries included.

    I would avoid XML and pickle.
     
    Steve Howell, Nov 23, 2009
    #3
  4. On Mon, 23 Nov 2009 14:49:51 +1100, Lie Ryan <>
    declaimed the following in gmane.comp.python.general:

    > For a personal book collection where the number of books is around ~300
    > books and you don't care about porting to another system, pickled
    > dictionary may be just good enough.


    300 books? Small collection... I've got 70 boxes -- 6"x12"x24" (1
    cubic foot each) -- in storage, just full of books. And close to 100
    books in just one bookcase in my living room <G>
    --
    Wulfraed Dennis Lee Bieber KD6MOG
    HTTP://wlfraed.home.netcom.com/
     
    Dennis Lee Bieber, Nov 23, 2009
    #4
  5. ~km

    ~km Guest

    > Though many would disagree, I consider XML as a form of database though
    > it is only suitable for data exchange. XML is suitable for low- to
    > medium-volume purpose and when compatibility with various systems is
    > extremely important (nearly any OS and any programming language has XML
    > parsers; porting a DBMS system may not be as easy as that).

    Thanks for the feedback. I consider XML as not very readable, so I
    prefer
    a Mark-up language like YAML. Cleaner syntax... but well, that's
    personal
    preference.

    > Python dictionary is stored in memory and closing the program ==
    > deleting the database. [...]

    My error.. although pickling I would only "prefer" if organizing <100
    books.
     
    ~km, Nov 23, 2009
    #5
  6. ~km

    Aahz Guest

    In article <4b0a06b8$>,
    Lie Ryan <> wrote:
    >
    >Python dictionary is stored in memory and closing the program ==
    >deleting the database. You can pickle dictionary; and this might be
    >sufficient for quick and dirty, low-volume purpose. Pickled dictionary
    >is the least portable solution; only python program can open a
    >pickled dictionary and even different versions of python may have
    >incompatibilities.


    While that last sentence is technically true, I've never seen it be an
    issue for this kind of application when changing versions upward. IOW,
    pickles from previous versions of Python can almost always be read.
    --
    Aahz () <*> http://www.pythoncraft.com/

    The best way to get information on Usenet is not to ask a question, but
    to post the wrong information.
     
    Aahz, Nov 29, 2009
    #6
    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. Xavier
    Replies:
    0
    Views:
    421
    Xavier
    Aug 6, 2003
  2. Skip Montanaro
    Replies:
    1
    Views:
    436
    Thomas Heller
    Aug 7, 2003
  3. snacktime
    Replies:
    13
    Views:
    567
    Dan Sommers
    Feb 22, 2005
  4. Uwe Mayer

    changing from python2.3 to python2.4

    Uwe Mayer, Apr 8, 2005, in forum: Python
    Replies:
    1
    Views:
    305
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Apr 9, 2005
  5. Ksenia Marasanova
    Replies:
    2
    Views:
    355
    Mike Meyer
    Nov 17, 2005
Loading...

Share This Page