Marcin201 a écrit :
Others have already replied to your main question; in short you
shouldn't rely on __del__ being called. Regardless, is there a (good)
reason for having an instance reference to the method ? Without
further information, that seems like a code smell.
I have dictionary of fxns
> Others have already replied to your main question; in short you
> shouldn't rely on __del__ being called. Regardless, is there a (good)
> reason for having an instance reference to the method ? Without
> further information, that seems like a code smell.
I have dictionary of fxns to do import/ex
On Sep 28, 12:00 pm, Marcin201 <[EMAIL PROTECTED]> wrote:
> I have a class which uses a temporary directory for storing data. I
> would like that directory to be removed when the class is no longer
> used. I have tried removing the temporary directory from the class
> destructor, however, it was
Marcin201 a écrit :
class Foo:
def __init__(self):
print "Hello"
self.f = self.fxn
Maybe self.f = self.fxn() is what you want. Note the '()'.
--
Michel Leunen
http://linux.leunen.com
--
http://mail.python.org/mailman/listinfo/python-list
In article
<[EMAIL PROTECTED]>,
Marcin201 <[EMAIL PROTECTED]> wrote:
> I have a class which uses a temporary directory for storing data. I
> would like that directory to be removed when the class is no longer
> used. I have tried removing the temporary directory from the class
> destructor, ho
On Sep 28, 6:00 pm, Marcin201 <[EMAIL PROTECTED]> wrote:
> I have a class which uses a temporary directory for storing data. I
> would like that directory to be removed when the class is no longer
> used. I have tried removing the temporary directory from the class
> destructor, however, it was n
I have a class which uses a temporary directory for storing data. I
would like that directory to be removed when the class is no longer
used. I have tried removing the temporary directory from the class
destructor, however, it was never called. After I while I traced the
problem to the class hav
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>> >> def __del__ (self):
>> >> try:
>> >> os.remove (self.name + '.old')
>> >> except:
>> >> pass
>>
>> >> And setting:
>> >> sys.stderr = logger(...)
>>
>> >> It seems my cleanup (__del__) is never called,
On Jun 15, 7:07 pm, Neal Becker <[EMAIL PROTECTED]> wrote:
> Bruno Desthuilliers wrote:
> > Neal Becker a écrit :
> >> To implement logging, I'm using a class:
>
> > If I may ask : any reason not to use the logging module in the stdlib ?
>
> Don't exactly recall, but needed some specific behavior a
Bruno Desthuilliers wrote:
> Neal Becker a écrit :
>> To implement logging, I'm using a class:
>
> If I may ask : any reason not to use the logging module in the stdlib ?
Don't exactly recall, but needed some specific behavior and it was just
easier this way.
>
>> class logger (object):
>>
Neal Becker a écrit :
> To implement logging, I'm using a class:
If I may ask : any reason not to use the logging module in the stdlib ?
> class logger (object):
> def __init__ (self, name):
> self.name = name
> self.f = open (self.name, 'w')
> def write (self, stuff):
>
To implement logging, I'm using a class:
class logger (object):
def __init__ (self, name):
self.name = name
self.f = open (self.name, 'w')
def write (self, stuff):
self.f.write (stuff)
def close (self):
self.f.close()
def flush (self):
self.f.
12 matches
Mail list logo