Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74425

Re: Do I need to call close on the handle returned by urlopen?

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Do I need to call close on the handle returned by urlopen?
Date 2014-07-14 16:20 +0100
References <lq0sar$r6e$1@mx1.internetia.pl>
Newsgroups comp.lang.python
Message-ID <mailman.11799.1405351227.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 14/07/2014 15:59, krzysztof.zelechowski@syncron.com wrote:
> The tutorial says that I should use "with open" to close the file handle
> properly.  The reference documentation for urlopen mentions that the handle
> returned is like a file handle but the code samples below do not bother to
> close the handle at all.  Isn’t it inconsistent?

Yes it is.  The latter probably hasn't been updated after the 
introduction of the 'with' keyword and context managers.  Would you like 
to click on the "Report a bug" link on the page in question and suggest 
a change?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Do I need to call close on the handle returned by urlopen? <krzysztof.zelechowski@syncron.com> - 2014-07-14 16:59 +0200
  Re: Do I need to call close on the handle returned by urlopen? <krzysztof.zelechowski@syncron.com> - 2014-07-14 17:08 +0200
  Re: Do I need to call close on the handle returned by urlopen? Skip Montanaro <skip@pobox.com> - 2014-07-14 10:09 -0500
  Re: Do I need to call close on the handle returned by urlopen? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-14 16:20 +0100

csiph-web