Skip to content

Commit

Permalink
Issues python#11670: Merge configparser doc from 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
vadmium committed Jan 29, 2017
2 parents b154113 + 1f10671 commit e334a53
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Doc/library/configparser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1161,20 +1161,20 @@ ConfigParser Objects
Use :meth:`read_file` instead.

.. versionchanged:: 3.2
:meth:`readfp` now iterates on *f* instead of calling ``f.readline()``.
:meth:`readfp` now iterates on *fp* instead of calling ``fp.readline()``.

For existing code calling :meth:`readfp` with arguments which don't
support iteration, the following generator may be used as a wrapper
around the file-like object::

def readline_generator(f):
line = f.readline()
def readline_generator(fp):
line = fp.readline()
while line:
yield line
line = f.readline()
line = fp.readline()

Instead of ``parser.readfp(f)`` use
``parser.read_file(readline_generator(f))``.
Instead of ``parser.readfp(fp)`` use
``parser.read_file(readline_generator(fp))``.


.. data:: MAX_INTERPOLATION_DEPTH
Expand Down

0 comments on commit e334a53

Please sign in to comment.