Antoine Pitrou writes:
> On Thu, 18 Nov 2010 12:46:07 +0100
> trylks wrote:
>> Hi!
>>
>> Would it be possible to use a with statement with an HTTPConnection object?
>>
>> I know it is not possible at this moment, it doesn't implement an
>> __exit__ method, at least in version 3.1.1. I was wond
On Thu, 18 Nov 2010 12:46:07 +0100
trylks wrote:
> Hi!
>
> Would it be possible to use a with statement with an HTTPConnection object?
>
> I know it is not possible at this moment, it doesn't implement an
> __exit__ method, at least in version 3.1.1. I was wondering if the
> __exit__ method shou
On Thu, Nov 18, 2010 at 3:46 AM, trylks wrote:
> Hi!
>
> Would it be possible to use a with statement with an HTTPConnection object?
Yes, via http://docs.python.org/library/contextlib.html#contextlib.closing
from httplib import HTTPConnection
from contextlib import closing
with closing(HTTPConn
Hi!
Would it be possible to use a with statement with an HTTPConnection object?
I know it is not possible at this moment, it doesn't implement an
__exit__ method, at least in version 3.1.1. I was wondering if the
__exit__ method should do something more than conn.close(), something
really hard or