Senthil Kumaran <sent...@uthcode.com> added the comment:

well, urlopen does return an file like object for socket connection which 
closes itself when it goes out of scope, as you raised this bug, I think a more 
explicit context manager like behavior can be tried. But I am afraid that it 
would complex to implement with the module than it sounds.

I see some example illustrated like this:
http://stackoverflow.com/questions/1522636/should-i-call-close-after-urllib-urlopen

import contextlib

with contextlib.closing(urllib.urlopen(u)) as x:
   ...use x at will here...


But it would be good to have this ticket as a feature request open.

----------
assignee:  -> orsenthil
nosy: +orsenthil
status: closed -> open

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12365>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to