From 5ddc2ffeb23b802d43e3dbbfce5b86200297a54f Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sun, 29 Jun 2025 05:08:20 +0100 Subject: [PATCH] =?UTF-8?q?gh-131885:=20=1BUpdate=20csv.rst=20to=20describ?= =?UTF-8?q?e=20that=20`csv.reader`=20and=20`csv.writer`=20have=20some=20po?= =?UTF-8?q?sitional-only=20arguments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```python import csv with open("example.csv", "w", newline='') as csvfile: csv.writer(csvfile=csvfile) # TypeError: expected at least 1 argument, got 0 ``` ```python import csv csv.reader(csvfile="a") # TypeError: expected at least 1 argument, got 0 ``` --- Doc/library/csv.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst index 2e513bff651cd2..bdec54b6d69457 100644 --- a/Doc/library/csv.rst +++ b/Doc/library/csv.rst @@ -53,7 +53,7 @@ The :mod:`csv` module defines the following functions: .. index:: single: universal newlines; csv.reader function -.. function:: reader(csvfile, dialect='excel', **fmtparams) +.. function:: reader(csvfile, /, dialect='excel', **fmtparams) Return a :ref:`reader object ` that will process lines from the given *csvfile*. A csvfile must be an iterable of @@ -84,7 +84,7 @@ The :mod:`csv` module defines the following functions: Spam, Lovely Spam, Wonderful Spam -.. function:: writer(csvfile, dialect='excel', **fmtparams) +.. function:: writer(csvfile, /, dialect='excel', **fmtparams) Return a writer object responsible for converting the user's data into delimited strings on the given file-like object. *csvfile* can be any object with a