Re: csv module strangeness.

2006-08-31 Thread tobiah
John Machin wrote: > tobiah wrote: >>> >>> >> I agree with Henryk's evaluation > > Henryk?? Have I missed a message in the thread, or has the effbot > metamorphosed into the aitchbot? > How strange. Either my client was whacked, or I was. I was actually referring to your "baroque byzantine ov

Re: csv module strangeness.

2006-08-31 Thread John Machin
tobiah wrote: > > > > > > > > I agree with Henryk's evaluation Henryk?? Have I missed a message in the thread, or has the effbot metamorphosed into the aitchbot? -- http://mail.python.org/mailman/listinfo/python-list

Re: csv module strangeness.

2006-08-31 Thread tobiah
>> The docs clearly state what the defaults are, but they are not >> in the code. It seems so clumsy to have to specify every one of >> these, just to change the delimiter from comma to tab. >> >> http://docs.python.org/lib/csv-fmt-params.html : > > The "it defaults to" clauses should probably

Re: csv module strangeness.

2006-08-31 Thread Fredrik Lundh
tobiah wrote: >> you may be misreading the docs; the Dialect has no values at all, and >> must be subclassed (and the subclass must provide settings). > > The docs clearly state what the defaults are, but they are not > in the code. It seems so clumsy to have to specify every one > of these,

Re: csv module strangeness.

2006-08-30 Thread John Machin
tobiah wrote: > > However, more generally, the docs also clearly state that "In addition > > to, or instead of, the dialect parameter, the programmer can also > > specify individual formatting parameters, which have the same names as > > the attributes defined below for the Dialect class." > > I d

Re: csv module strangeness.

2006-08-30 Thread tobiah
> However, more generally, the docs also clearly state that "In addition > to, or instead of, the dialect parameter, the programmer can also > specify individual formatting parameters, which have the same names as > the attributes defined below for the Dialect class." I definitely missed that. Kn

Re: csv module strangeness.

2006-08-30 Thread John Machin
tobiah wrote: > > The docs clearly state what the defaults are, but they are not > in the code. It seems so clumsy to have to specify every one > of these, just to change the delimiter from comma to tab. > That particular case is handled by the built-in (but cunningly concealed) 'excel-tab' clas

Re: csv module strangeness.

2006-08-30 Thread tobiah
for row in csv.reader(instream, delimiter="\t"): Awesome. Thanks. -- Posted via a free Usenet account from http://www.teranews.com -- http://mail.python.org/mailman/listinfo/python-list

Re: csv module strangeness.

2006-08-30 Thread Peter Otten
tobiah wrote: >> you may be misreading the docs; the Dialect has no values at all, and >> must be subclassed (and the subclass must provide settings). > > The docs clearly state what the defaults are, but they are not > in the code. It seems so clumsy to have to specify every one > of these, jus

Re: csv module strangeness.

2006-08-30 Thread skip
tobiah> So now it works, but it is still strange about the absent tobiah> defaults. The csv.Dialect class is essentially pure abstract. Most of the time I subclass csv.excel and just change the one or two things I need. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: csv module strangeness.

2006-08-30 Thread tobiah
> you may be misreading the docs; the Dialect has no values at all, and > must be subclassed (and the subclass must provide settings). The docs clearly state what the defaults are, but they are not in the code. It seems so clumsy to have to specify every one of these, just to change the delim

Re: csv module strangeness.

2006-08-30 Thread tobiah
> > That's possible but why didn't you follow the way `csv.Dialect` set the > class attributes? > > class MyDialect(csv.Dialect): > delimiter = '\t' > lineterminator = '\n' > # and so on… Because I'm hung over. -- Posted via a free Usenet account from http://www.teranews.com --

Re: csv module strangeness.

2006-08-30 Thread Fredrik Lundh
tobiah wrote: > The docs are a little terse, but I gather that I am supposed > to subclass cvs.Dialect: > > class dialect(csv.Dialect): > pass > > Now, the docs say that all of the attributes have reasonable > defaults, but instantiating the above gives: you may be misreading the docs;

Re: csv module strangeness.

2006-08-30 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, tobiah wrote: > I'm trying to create a cvs.reader object using a custom dialect. > > The docs are a little terse, but I gather that I am supposed > to subclass cvs.Dialect: > > class dialect(csv.Dialect): > pass > > Now, the docs say that all of the attributes ha

Re: csv module strangeness.

2006-08-30 Thread tobiah
Ok, I'm an idiot. I didn't even pass my dialect object to the reader() call. So now it works, but it is still strange about the absent defaults. Tobiah > This runs, but the delimiter is still the comma. > When list.csv is comma delim, it works correctly, > but when list.csv has tab separated v

csv module strangeness.

2006-08-30 Thread tobiah
I'm trying to create a cvs.reader object using a custom dialect. The docs are a little terse, but I gather that I am supposed to subclass cvs.Dialect: class dialect(csv.Dialect): pass Now, the docs say that all of the attributes have reasonable defaults, but instantiating the above gives