Announce: csv_xs.py

Discussion in 'Python' started by Christian Meissner, Nov 10, 2004.

  1. Hi Folk,

    i had developed my own csv class which is inspired by perls csv_xs module.

    All interrested people can find the class on

    http://www.linux-scene.de/files/python/

    Hope it helps, you'll be pleased to extend the class

    Chris
    Christian Meissner, Nov 10, 2004
    #1
    1. Advertising

  2. Christian> i had developed my own csv class which is inspired by perls
    Christian> csv_xs module.

    Can you explain what you liked about Perl's csv_xz package and/or didn't
    like about Python's csv module that motivated you to write your own class?

    Thx,

    Skip
    Skip Montanaro, Nov 10, 2004
    #2
    1. Advertising

  3. > Can you explain what you liked about Perl's csv_xz package and/or didn't
    > like about Python's csv module that motivated you to write your own class?
    >
    > Thx,
    >
    > Skip


    I'm a native perl speaker, but at my last work i had to learn python, to
    edit some zope thinks (quite difficult).

    Now i wanna learn python for me and i often work with csv files with perl
    but now i wanna develop some python programs for csv file working.
    In this task i would extend the csv module for my needs but there i get any
    errors, so it was easier for me to develop a class which is like the perl
    one.

    hope it is ok
    Chris
    Christian Meissner, Nov 10, 2004
    #3
  4. Christian Meissner wrote:

    > I had developed my own csv class which is inspired by perls csv_xs module.


    What you do is not csv parsing!

    You are just splitting the rows by
    the separator character (a triviality).
    But this character may be inside the field
    enclosed within quotation characters.


    Istvan.
    Istvan Albert, Nov 10, 2004
    #4
  5. > What you do is not csv parsing!
    >
    > You are just splitting the rows by
    > the separator character (a triviality).
    > But this character may be inside the field
    > enclosed within quotation characters.
    >
    >
    > Istvan.


    atm it is work in progress, so i will extends it if it is nessesary ...
    Christian Meissner, Nov 10, 2004
    #5

  6. >> What you do is not csv parsing!
    >>
    >> You are just splitting the rows by the separator character...


    Chris> ... i will extends it if it is nessesary ...

    Trust me, you will eventually find it to be necessary. ;-)

    Skip
    Skip Montanaro, Nov 10, 2004
    #6
  7. Christian Meissner

    John Machin Guest

    Christian Meissner <> wrote in message news:<BDB82EB7.1CA7%>...
    > > Can you explain what you liked about Perl's csv_xz package and/or didn't
    > > like about Python's csv module that motivated you to write your own class?
    > >

    >
    > I'm a native perl speaker, but at my last work i had to learn python, to
    > edit some zope thinks (quite difficult).
    >
    > Now i wanna learn python for me and i often work with csv files with perl
    > but now i wanna develop some python programs for csv file working.
    > In this task i would extend the csv module for my needs


    What are your needs, that are not covered by Python's csv module?
    You have this comment near the beginning of your source file:
    "This File contains classes, which enable you to get mor efficient
    access to
    csv - files."
    How do you define efficiency? Speed of reading files? Last time I
    looked, the guts of the Python csv module was written in C. Memory
    footprint? Try sucking in a file with a few million records with your
    module and check the memory usage.


    > but there i get any
    > errors,


    What errors did you get when you tried to use the Python module?

    > so it was easier for me to develop a class which is like the perl
    > one.
    >
    > hope it is ok


    Istvan has already covered this topic.

    > Chris
    John Machin, Nov 11, 2004
    #7
  8. Christian Meissner

    Y2KYZFR1 Guest

    Christian Meissner <> wrote in message news:<BDB82EB7.1CA7%>...
    > > Can you explain what you liked about Perl's csv_xz package and/or didn't
    > > like about Python's csv module that motivated you to write your own class?
    > >
    > > Thx,
    > >
    > > Skip

    >
    > I'm a native perl speaker, but at my last work i had to learn python, to
    > edit some zope thinks (quite difficult).
    >
    > Now i wanna learn python for me and i often work with csv files with perl
    > but now i wanna develop some python programs for csv file working.
    > In this task i would extend the csv module for my needs but there i get any
    > errors, so it was easier for me to develop a class which is like the perl
    > one.
    >
    > hope it is ok
    > Chris


    to a hammer everything looks like a nail!
    Y2KYZFR1, Nov 16, 2004
    #8
  9. Christian Meissner

    Mike Meyer Guest

    (Y2KYZFR1) writes:

    > > Can you explain what you liked about Perl's csv_xz package and/or didn't
    > > like about Python's csv module that motivated you to write your own class?
    > >
    > > Thx,
    > >
    > > Skip

    >
    > I'm a native perl speaker, but at my last work i had to learn python, to
    > edit some zope thinks (quite difficult).
    >
    > Now i wanna learn python for me and i often work with csv files with perl
    > but now i wanna develop some python programs for csv file working.
    > In this task i would extend the csv module for my needs but there i get any
    > errors, so it was easier for me to develop a class which is like the perl
    > one.
    >
    > hope it is ok
    > Chris


    If I interpret this correctly as "get many errors", then you're
    throwing away one of the benefits Python has over Perl. Perl silently
    does something implicit with errors in your data. Python requires that
    they be dealt with explicitly. It may be that Perl does the right
    thing for you. But in many cases, Perl *doesn't* do the right
    thing. Python lets you decide how to deal with them, and makes that
    explicit.

    <mike
    --
    Mike Meyer <> http://www.mired.org/home/mwm/
    Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
    Mike Meyer, Nov 16, 2004
    #9
    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. Andreas Otto
    Replies:
    0
    Views:
    260
    Andreas Otto
    Sep 25, 2009
  2. Domenico Discepola

    Assistance parsing text file using Text::CSV_XS

    Domenico Discepola, Sep 1, 2004, in forum: Perl Misc
    Replies:
    6
    Views:
    441
    Domenico Discepola
    Sep 2, 2004
  3. Alex Hunsley
    Replies:
    1
    Views:
    104
    Alex Hunsley
    Jun 28, 2005
  4. Pam
    Replies:
    3
    Views:
    149
    J. Gleixner
    Oct 3, 2006
  5. CSV_XS Question

    , Apr 14, 2008, in forum: Perl Misc
    Replies:
    1
    Views:
    132
    Ben Morrow
    Apr 14, 2008
Loading...

Share This Page