E
Emmanuel
Hi,
I run across this problem, and couldn't find any solution (python 2.2.2)
:
Code :
===========
from __future__ import generators
def __init__(self):
print "init"
def __del__(self):
print "del"
def Gen(self):
yield 1
==============
Here, everything is normal...
But creating a generator :
Code :
===========
def __init__(self):
print "init"
self.Coroutine = self.Gen()
def __del__(self):
print "del"
def Gen(self):
yield 1
==============
I can't understand why the destructor is not called when a generator is
created, and what I should do to have a "correct" behavior.
(perhaps I missed something obvious, but I can't find it )
Thank you for any help,
Emmanuel
I run across this problem, and couldn't find any solution (python 2.2.2)
:
Code :
===========
from __future__ import generators
def __init__(self):
print "init"
def __del__(self):
print "del"
def Gen(self):
yield 1
delc = titi() init
c = []
==============
Here, everything is normal...
But creating a generator :
Code :
===========
def __init__(self):
print "init"
self.Coroutine = self.Gen()
def __del__(self):
print "del"
def Gen(self):
yield 1
<--- Nothing there !!!a = toto() init
c = []
==============
I can't understand why the destructor is not called when a generator is
created, and what I should do to have a "correct" behavior.
(perhaps I missed something obvious, but I can't find it )
Thank you for any help,
Emmanuel