]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-74232: Add a note about roundtrip of non-float numerics in CSV (GH-134963)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 2 Jun 2025 20:31:06 +0000 (23:31 +0300)
committerGitHub <noreply@github.com>
Mon, 2 Jun 2025 20:31:06 +0000 (23:31 +0300)
Doc/library/csv.rst

index 533cdf13974be612c54d43225c0d5694bf1b8e4b..5297be17bd708e3ce9d4ee1823b731f33b8a88d2 100644 (file)
@@ -70,7 +70,7 @@ The :mod:`csv` module defines the following functions:
    section :ref:`csv-fmt-params`.
 
    Each row read from the csv file is returned as a list of strings.  No
-   automatic data type conversion is performed unless the ``QUOTE_NONNUMERIC`` format
+   automatic data type conversion is performed unless the :data:`QUOTE_NONNUMERIC` format
    option is specified (in which case unquoted fields are transformed into floats).
 
    A short usage example::
@@ -331,8 +331,14 @@ The :mod:`csv` module defines the following constants:
 
    Instructs :class:`writer` objects to quote all non-numeric fields.
 
-   Instructs :class:`reader` objects to convert all non-quoted fields to type *float*.
+   Instructs :class:`reader` objects to convert all non-quoted fields to type :class:`float`.
 
+   .. note::
+      Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`,
+      or :class:`~enum.IntEnum`, have a string representation that cannot be
+      converted to :class:`float`.
+      They cannot be read in the :data:`QUOTE_NONNUMERIC` and
+      :data:`QUOTE_STRINGS` modes.
 
 .. data:: QUOTE_NONE