Author terry.reedy
Recipients Valery.Khamenya, docs@python, ezio.melotti, orsenthil, terry.reedy
Date 2011-09-16.21:54:09
SpamBayes Score 6.12574e-09
Marked as misclassified No
Message-id <1316210049.75.0.839091032042.issue12955@psf.upfronthosting.co.za>
In-reply-to
Content
On 3.2.2, your example (adapted) produces
>>> 
2945 characters fetched

So, as Senthil said, the requested feature already exists. But it cannot be added to the 2.7 series; the Python 2.7 *language* is feature frozen. 2.7.z bug fixes serve to make the implementation better match the intended language.

Prior to the addition of with..., the standard way to close things was with explicit .close() or implicit closing when the function returned or the program exited. In the 3.2 docs, "20.5.21. Examples", there are several examples with
  f = <some opener>
  <do something with f>
  (closing ignored)
Where possible, these could and should be changed in 3.2+ docs to
  with <some opener> as f:
    <do something with f>
to promote the new idiom.  This had been done in other chapters. Perhaps there is also a need for 'X supports the context manager protocol' to be added here or there. But showing that in the examples would make the point.

I have changed the title of this issue to match.
History
Date User Action Args
2011-09-16 21:54:09terry.reedysetrecipients: + terry.reedy, orsenthil, ezio.melotti, docs@python, Valery.Khamenya
2011-09-16 21:54:09terry.reedysetmessageid: <1316210049.75.0.839091032042.issue12955@psf.upfronthosting.co.za>
2011-09-16 21:54:09terry.reedylinkissue12955 messages
2011-09-16 21:54:09terry.reedycreate