On Tue, Dec 20, 2011 at 11:46 AM, Ian Kelly wrote:
> On Tue, Dec 20, 2011 at 9:56 AM, Ulrich Eckhardt
> wrote:
>> Am 20.12.2011 15:15, schrieb Ulrich Eckhardt:
>>
>>> Let us assume I had a class HTTPClient that has a socket for HTTP and a
>>> logfile for filing logs. I want to make this HTTPClien
Rami Chowdhury wrote:
On Tue, Dec 20, 2011 at 16:56, Ulrich Eckhardt
wrote:
To be extra safe or in more complicated scenarios, I could wrap this in a
try-except and explicitly close those that were already created, but
normally I'd expect the garbage collector to do that for me ... or am I then
On Tue, Dec 20, 2011 at 9:56 AM, Ulrich Eckhardt
wrote:
> Am 20.12.2011 15:15, schrieb Ulrich Eckhardt:
>
>> Let us assume I had a class HTTPClient that has a socket for HTTP and a
>> logfile for filing logs. I want to make this HTTPClient a context
>> manager, so that I can write
>>
>> with HTTPC
On Tue, Dec 20, 2011 at 16:56, Ulrich Eckhardt
wrote:
> To be extra safe or in more complicated scenarios, I could wrap this in a
> try-except and explicitly close those that were already created, but
> normally I'd expect the garbage collector to do that for me ... or am I then
> implicitly assum
Am 20.12.2011 15:15, schrieb Ulrich Eckhardt:
Let us assume I had a class HTTPClient that has a socket for HTTP and a
logfile for filing logs. I want to make this HTTPClient a context
manager, so that I can write
with HTTPClient(url) as client:
pass
Actually, I overestimated the task:
c
On Tue, Dec 20, 2011 at 14:15, Ulrich Eckhardt
wrote:
> Hi!
>
> Let us assume I had a class HTTPClient that has a socket for HTTP and a
> logfile for filing logs. I want to make this HTTPClient a context manager,
> so that I can write
>
> with HTTPClient(url) as client:
> pass
>
> and reliab
Hi!
Let us assume I had a class HTTPClient that has a socket for HTTP and a
logfile for filing logs. I want to make this HTTPClient a context
manager, so that I can write
with HTTPClient(url) as client:
pass
and reliably have both the socket and the logfile closed. The easy way
is w