[docs] [issue22755] contextlib.closing documentation should use a new example

Martijn Pieters report at bugs.python.org
Tue Oct 28 23:40:52 CET 2014


New submission from Martijn Pieters:

urllib.request.urlopen() now always produces a context manager (either a HTTPResponse or addinfourl object). The example for contextlib.closing still uses urllib.request.urlopen as an example for the context manager wrapper, see

    https://docs.python.org/3/library/contextlib.html#contextlib.closing

This is confusing users that now expect the object not to be a context manager, see:

    http://stackoverflow.com/questions/26619404/with-and-closing-of-files-in-python

Can a different example be chosen?

----------
assignee: docs at python
components: Documentation
messages: 230184
nosy: docs at python, mjpieters
priority: normal
severity: normal
status: open
title: contextlib.closing documentation should use a new example
versions: Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22755>
_______________________________________


More information about the docs mailing list