Request for a change in the csv module.

Paulo da Silva psdasilvaX at esotericaX.ptX
Tue Mar 13 07:23:24 EDT 2007


Diez B. Roggisch escreveu:
> Paulo da Silva schrieb:
...

>> That works but it is a pain to use.
> 
> Why? I think it's straightforward.

That is not the point. The problem is to have things generalized.
I have some general purpose tables whose fields format I don't know
in advance.
Internally the numeric values are independent of localization.
Having a table, I don't like the idea of preformating things
before sending them to the csv for exportation. A little more
of programming and there will be no need for csv at all :-)
...
> The same is essentially true for dates as well, btw. How do you want to
> deal with them?

This is a pertinent question I didn't think of. May be csv should handle
data conversions using 'locale'.
It is already automatically converting numbers to text
anyway, but unconditionally using the '.'.
As for the dates the dialect could include a format like YYYY-MM-DD
hh:mm:ss. Dates are not always 'locale' only. In pt_PT we use
YYYY-MM-DD or YY-MM-DD and sometimes DD-MM-YYYY.
One must remember that csv is not part of the language. So, to have
some kind of universality, it must use the specs (in dialect) for
formatting and 'locale' for data conversions.




More information about the Python-list mailing list