This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: csv docs say 'excel_tab'; code says 'excel-tab'
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: skip.montanaro Nosy List: dcelzinga, skip.montanaro
Priority: normal Keywords:

Created on 2007-10-02 04:00 by dcelzinga, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg56211 - (view) Author: Dean Elzinga (dcelzinga) Date: 2007-10-02 04:00
I was trying out 'csv module' and noticed that it wouldn't accept a
dialect of 'excel_tab' as documented.

Then I noticed that csv.list_dialects() gave 'excel-tab' instead of
'excel_tab' as documented.

I'm not sure which one it's supposed to be, but I guess when in doubt
the docs are wrong. I leave these issues to the higher gods.

Thanks for the work on this module. I'm enjoying it!
msg56214 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2007-10-02 15:14
The string name of the dialect is "excel-tab".  Hyphens are not
valid characters in identifiers though, so the actual object
is named "excel_tab".  When you call csv.get_dialect("excel-tab")
it instantiates the csv.excel_tab class and returns that:

>>> csv.list_dialects()
['excel-tab', 'excel']
>>> csv.get_dialect("excel-tab")
<csv.excel_tab instance at 0x820b50c>
>>> csv.excel_tab
<class csv.excel_tab at 0x81f9f5c>
>>> csv.get_dialect("excel-tab").__class__ == csv.excel_tab
True
msg56215 - (view) Author: Dean Elzinga (dcelzinga) Date: 2007-10-02 16:09
Ohh! Thanks for the clarification. Sorry for the misunderstanding.

> -----Original Message-----
> From: Skip Montanaro [mailto:report@bugs.python.org]
> Sent: Tuesday, October 02, 2007 8:14 AM
> To: dcelzinga@gmail.com
> Subject: [issue1227] csv docs say 'excel_tab'; code says
> 'excel-tab'
> 
> 
> Skip Montanaro added the comment:
> 
> The string name of the dialect is "excel-tab".  Hyphens
> are not
> valid characters in identifiers though, so the actual
> object
> is named "excel_tab".  When you call
> csv.get_dialect("excel-tab")
> it instantiates the csv.excel_tab class and returns that:
> 
> >>> csv.list_dialects()
> ['excel-tab', 'excel']
> >>> csv.get_dialect("excel-tab")
> <csv.excel_tab instance at 0x820b50c>
> >>> csv.excel_tab
> <class csv.excel_tab at 0x81f9f5c>
> >>> csv.get_dialect("excel-tab").__class__ ==
> csv.excel_tab
> True
> 
> ----------
> assignee:  -> skip.montanaro
> nosy: +skip.montanaro
> resolution:  -> works for me
> status: open -> closed
> 
> __________________________________
> Tracker <report@bugs.python.org>
> <http://bugs.python.org/issue1227>
> __________________________________
History
Date User Action Args
2022-04-11 14:56:27adminsetgithub: 45568
2007-10-02 16:09:56dcelzingasetmessages: + msg56215
2007-10-02 15:14:27skip.montanarosetstatus: open -> closed
assignee: skip.montanaro
resolution: works for me
messages: + msg56214
nosy: + skip.montanaro
2007-10-02 04:00:57dcelzingacreate