Vajrasky Kok added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18829>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to