[3.15] gh-80678: Document the preferred attribute of csv.Sniffer (GH-155068) (#155679)

hugovk <[email protected]>
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/e8396792a79adeb2dd6fe523b1722fe8ec6e50f7
commit: e8396792a79adeb2dd6fe523b1722fe8ec6e50f7
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: hugovk <[email protected]>
date: 2026-08-22T12:41:27+03:00
summary:

[3.15] gh-80678: Document the preferred attribute of csv.Sniffer (GH-155068) (#155679)

Co-authored-by: Serhiy Storchaka <[email protected]>

files:
M Doc/library/csv.rst

diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst
index 1ecaec296b000e..8b8c12d1a00f2e 100644
--- a/Doc/library/csv.rst
+++ b/Doc/library/csv.rst
@@ -314,8 +314,8 @@ The :mod:`!csv` module defines the following classes:
 
       If several delimiters fit the sample equally well ---
       for example if both ``','`` and ``';'`` split every row consistently ---
-      the delimiters ``','``, ``'\t'``, ``';'``, ``' '`` and ``':'``
-      are preferred, in this order,
+      the delimiters listed in the :attr:`~Sniffer.preferred` attribute
+      are preferred, in that order,
       no matter how many times each of them occurs.
 
    .. method:: has_header(sample)
@@ -337,6 +337,15 @@ The :mod:`!csv` module defines the following classes:
       This method is a rough heuristic and may produce both false positives and
       negatives.
 
+   The :class:`Sniffer` class has the following attribute:
+
+   .. attribute:: preferred
+
+      The list of the delimiters preferred for breaking ties,
+      in the order of preference.
+      It can be modified.
+      Its initial value is ``[',', '\t', ';', ' ', ':']``.
+
 An example for :class:`Sniffer` use::
 
    with open('example.csv', newline='') as csvfile:

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.