[Python-ideas] Add a context manager to keep stream position unchanged

Dmitry Kazakov jsbfox at gmail.com
Mon Mar 30 10:35:17 CEST 2015


If the final resolution is "we don't need this in the library", that's fine
- I agree that the proposal is trivial and doesn't gain much. OTOH the
contextlib.closing can also be said to be a simple exercise, because its
implementation is 22 lines long and it's equivalent to

@contextmanager
def closing(thing):
    try:
        yield thing
    finally:
        thing.close()

(from the docs)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150330/352cb47c/attachment.html>


More information about the Python-ideas mailing list