Skip to content

Commit b0b8f9b

Browse files
miss-islingtonZackerySpytz
authored andcommitted
bpo-27351: Fix ConfigParser.read() documentation and docstring (GH-8123)
Switch "list" with "iterable" to match with the implementation. (cherry picked from commit e45473e) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
1 parent 4c1b2ad commit b0b8f9b

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

Doc/library/configparser.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -995,16 +995,17 @@ ConfigParser Objects
995995

996996
.. method:: read(filenames, encoding=None)
997997

998-
Attempt to read and parse a list of filenames, returning a list of
998+
Attempt to read and parse an iterable of filenames, returning a list of
999999
filenames which were successfully parsed.
10001000

10011001
If *filenames* is a string, a :class:`bytes` object or a
10021002
:term:`path-like object`, it is treated as
10031003
a single filename. If a file named in *filenames* cannot be opened, that
1004-
file will be ignored. This is designed so that you can specify a list of
1005-
potential configuration file locations (for example, the current
1006-
directory, the user's home directory, and some system-wide directory),
1007-
and all existing configuration files in the list will be read.
1004+
file will be ignored. This is designed so that you can specify an
1005+
iterable of potential configuration file locations (for example, the
1006+
current directory, the user's home directory, and some system-wide
1007+
directory), and all existing configuration files in the iterable will be
1008+
read.
10081009

10091010
If none of the named files exist, the :class:`ConfigParser`
10101011
instance will contain an empty dataset. An application which requires

Lib/configparser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
Return list of configuration options for the named section.
8181
8282
read(filenames, encoding=None)
83-
Read and parse the list of named configuration files, given by
83+
Read and parse the iterable of named configuration files, given by
8484
name. A single filename is also allowed. Non-existing files
8585
are ignored. Return list of successfully read files.
8686
@@ -676,13 +676,13 @@ def options(self, section):
676676
return list(opts.keys())
677677

678678
def read(self, filenames, encoding=None):
679-
"""Read and parse a filename or a list of filenames.
679+
"""Read and parse a filename or an iterable of filenames.
680680
681681
Files that cannot be opened are silently ignored; this is
682-
designed so that you can specify a list of potential
682+
designed so that you can specify an iterable of potential
683683
configuration file locations (e.g. current directory, user's
684684
home directory, systemwide directory), and all existing
685-
configuration files in the list will be read. A single
685+
configuration files in the iterable will be read. A single
686686
filename may also be given.
687687
688688
Return list of successfully read files.

0 commit comments

Comments
 (0)