On Aug 11, 2:50 pm, Stefan Bellon <[EMAIL PROTECTED]> wrote:
> So why is the destructor not called when the generator is even
> explicitly 'del'ed? Does somebody else still hold a reference on it?
You ( we ) have produced a reference cycle. In that case __del__
doesn't work properly ( according t
On Sat, 11 Aug, Marc 'BlackJack' Rintsch wrote:
> On Sat, 11 Aug 2007 14:50:33 +0200, Stefan Bellon wrote:
> > But then, even when terminating the interpreter, __del__ is not
> > called.
>
> Because that is not guaranteed by the language reference. The reason
> why it is a bad idea to depend on
On Sat, 11 Aug 2007 14:50:33 +0200, Stefan Bellon wrote:
> On Sat, 11 Aug, Kay Schluehr wrote:
>
>> But why shall the destructor be called? Your example does not indicate
>> that a ListGenerator object is somewhere destroyed neither explicitely
>> using del nor implicitely by destroying the scope
On Sat, 11 Aug, Kay Schluehr wrote:
> But why shall the destructor be called? Your example does not indicate
> that a ListGenerator object is somewhere destroyed neither explicitely
> using del nor implicitely by destroying the scope it is living in.
After having constructed the list itself, the
On Aug 11, 2:00 pm, Stefan Bellon <[EMAIL PROTECTED]> wrote:
> On Sat, 11 Aug, Kay Schluehr wrote:
> > Honestly, I'd recommend wrapping the generator into a function object,
> > create the resource on construction ( or pass it ) and destroy it
> > implementing __del__.
>
> > def gen_value(self):
>
On Sat, 11 Aug, Kay Schluehr wrote:
> Honestly, I'd recommend wrapping the generator into a function object,
> create the resource on construction ( or pass it ) and destroy it
> implementing __del__.
>
> def gen_value(self):
> while True:
> yield self.iter.next()
>
> class Generator
On Aug 11, 12:16 pm, Stefan Bellon <[EMAIL PROTECTED]> wrote:
> On Sat, 11 Aug, Kay Schluehr wrote:
> > On Aug 9, 1:14 am, Stefan Bellon <[EMAIL PROTECTED]> wrote:
> > > Sorry, I forgot to mention that I am forced to using Python 2.4.
> > It doesn't matter. You can use try...finally as well in Pyth
On Sat, 11 Aug, Kay Schluehr wrote:
> On Aug 9, 1:14 am, Stefan Bellon <[EMAIL PROTECTED]> wrote:
> > Sorry, I forgot to mention that I am forced to using Python 2.4.
> It doesn't matter. You can use try...finally as well in Python 2.4.
> It's just not possible to use except and finally clauses i
On Aug 9, 1:14 am, Stefan Bellon <[EMAIL PROTECTED]> wrote:
> On Wed, 08 Aug, MRAB wrote:
> > Simple! :-)
>
> Sorry, I forgot to mention that I am forced to using Python 2.4.
>
> --
> Stefan Bellon
It doesn't matter. You can use try...finally as well in Python 2.4.
It's just not possible to use ex
Stefan Bellon <[EMAIL PROTECTED]> wrote:
> On Thu, 09 Aug, Graham Dumpleton wrote:
>
> > result = application(environ, start_response)
> > try:
> > for data in result:
> > if data:# don't send headers until body appears
> > write(data)
> > i
On Thu, 09 Aug, Graham Dumpleton wrote:
> result = application(environ, start_response)
> try:
> for data in result:
> if data:# don't send headers until body appears
> write(data)
> if not headers_sent:
> write('') # send heade
On Aug 8, 8:28 am, Stefan Bellon <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm generating a binding from Python to C using SWIG. On the C side I
> have iterators over some data structures. On the Python side I
> currently use code like the following:
>
> def get_data(obj):
> result = []
On Wed, 08 Aug, MRAB wrote:
> Simple! :-)
Sorry, I forgot to mention that I am forced to using Python 2.4.
--
Stefan Bellon
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 7, 11:28 pm, Stefan Bellon <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm generating a binding from Python to C using SWIG. On the C side I
> have iterators over some data structures. On the Python side I
> currently use code like the following:
>
> def get_data(obj):
> result = []
Hi all,
I'm generating a binding from Python to C using SWIG. On the C side I
have iterators over some data structures. On the Python side I
currently use code like the following:
def get_data(obj):
result = []
iter = make_iter(obj)
while more(iter):
item =
15 matches
Mail list logo