gh-80678: Document the preferred delimiters of csv.Sniffer#154336
Conversation
The delimiters which win when several combinations fit the sample equally well were not documented. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Documentation build overview
|
|
@smontanaro, you added this list of preferred delimiters in 2003, and you wrote in gh-75008 that you keep half an eye on the csv module. Could you please check that this describes the intended behavior? No obligation of course. |
I'm going to disclaim any involvement in this. It seems commit 04ae705 was the initial commit for |
|
I understand you very well. But it seems that it is really used. It is used in Panda, there are also several third-party implementations. Half of csv issues are related to Sniffer (my rewrite in main fixes almost all of them). |
|
@serhiy-storchaka It looks good to me. Is there a reason for not documenting the |
|
Thanks @serhiy-storchaka for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
Sorry, @serhiy-storchaka and @ambv, I could not cleanly backport this to |
|
Sorry, @serhiy-storchaka and @ambv, I could not cleanly backport this to |
|
Sorry, @serhiy-storchaka and @ambv, I could not cleanly backport this to |
The list of preferred delimiters exists since the module was added in 2003 and has never been documented, so it is only discoverable by reading the source. It decides the result whenever several candidates fit the sample equally well, no matter how many times each of them occurs — the case reported in the issue,
a;b;c;d,e;f;g;h, is still detected as,.Document this in the
Sniffer.sniff()documentation and docstring. Thepreferredattribute itself stays undocumented.