[issue43834] Use context manager in StringIO example

2021-04-19 Thread Benjamin Peterson
Benjamin Peterson added the comment: I agree that closing or using a context manager with StringIO (or BytesIO) is not something one normally has to do, so it doesn't need to be in the example. -- resolution: -> rejected status: open -> closed ___

[issue43834] Use context manager in StringIO example

2021-04-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Except for that, the PR looks fine. Leaving this open to see what Benjamin thinks. -- resolution: rejected -> status: closed -> open ___ Python tracker ___

[issue43834] Use context manager in StringIO example

2021-04-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Let's leave the example as-is. The principal use case for these objects is to pass them into other APIs that require file-like objects. Those can't always be put in a context manager. For this example, we mainly want to communicate that getvalue() mus

[issue43834] Use context manager in StringIO example

2021-04-16 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: +benjamin.peterson, stutzbach ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue43834] Use context manager in StringIO example

2021-04-14 Thread John Hagen
Change by John Hagen : -- keywords: +patch pull_requests: +24133 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25401 ___ Python tracker ___ _

[issue43834] Use context manager in StringIO example

2021-04-13 Thread John Hagen
New submission from John Hagen : The example for StringIO currently manually closes the object rather than using a context manager. Since this is likely the first code that a new user encounters and context managers reduce error-prone situations, I think it would be helpful to show usage as a