Is anyone happy with csv module?

John Machin sjmachin at lexicon.net
Tue Dec 11 19:19:41 EST 2007


On Dec 12, 10:35 am, "massimo s." <deviceran... at gmail.com> wrote:
>
> For example, I never ever looked into itertools. I am also not so
> familiar with iterators. Itertools seem fantastic, and I'll definitely
> look into them, however I can't but feel it's a bit strange that
> someone wanting a quick csv parsing/writing has to dig into those
> apparently unrelated stuff.

The idea is (should be) that each module should be a building block
which can be coupled with other modules as necessary to give the
desired result. A similar idea is found in *x command-line tools (e.g.
tr ... | sort ... | uniq ...). Otherwise each module would become a
"Swiss army knife" with its API littered with tiny functions calling
stuff in other modules.

> > > (Btw: who is using csv to read >10**6 lines of data?)
>
> > Me, and many others AFAIK. 1M lines is not so big, btw.
>
> It's clear that I am thinking to completely different usages for CSV
> than what most people in this thread. I use csv to export and import
> numerical data columns to and from spreadsheets.

For that purpose, CSV files are the utter pox and then some. Consider
using xlrd and xlwt (nee pyexcelerator) to read (resp. write) XLS
files directly.

Cheers,
John



More information about the Python-list mailing list