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.

Author vajrasky
Recipients Thibault.Kruse, ezio.melotti, r.david.murray, serhiy.storchaka, vajrasky
Date 2013-09-08.15:39:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1378654789.03.0.658667938133.issue18829@psf.upfronthosting.co.za>
In-reply-to
Content
After contemplating for a while, I am not sure that we should treat empty string for delimiter with error message: '"delimiter" must be an 1-character string'.

The reason is to keep consistency with quotechar keyword.

[sky@localhost cpython]$ ./python -c 'import csv; reader = csv.reader("foo", quotechar="")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: quotechar must be set if quoting enabled

[sky@localhost cpython]$ ./python -c 'import csv; reader = csv.reader("foo", quotechar="", quoting=csv.QUOTE_NONE)'
# No error, so implicitly quotechar is not set, but it is okay since we use "quote none" quoting.
# In other word, quotechar is not set by giving empty string to quotechar.

We could not change the behaviour of csv module, which is unsetting quotechar by giving empty string to quotechar and let it be if we use "quote none" quoting, to preserve backward compatibility.

So the error message should be, "The delimiter must be set" for empty string for delimiter, I suppose.
History
Date User Action Args
2013-09-08 15:39:49vajraskysetrecipients: + vajrasky, ezio.melotti, r.david.murray, serhiy.storchaka, Thibault.Kruse
2013-09-08 15:39:49vajraskysetmessageid: <1378654789.03.0.658667938133.issue18829@psf.upfronthosting.co.za>
2013-09-08 15:39:49vajraskylinkissue18829 messages
2013-09-08 15:39:48vajraskycreate