Re: Messing with the GC

2013-01-20 Thread Jens Thoms Toerring
Terry Reedy wrote: > On 1/20/2013 3:09 PM, Jens Thoms Toerring wrote: > > thank you for the explanations. I had overlooked the > > cyclic nature of what I had produced here and, of course, > > the GC can't be blamed for not collecting objects that are > > part of a cycle. The other question

Re: Messing with the GC

2013-01-20 Thread Terry Reedy
On 1/20/2013 3:09 PM, Jens Thoms Toerring wrote: thank you for the explanations. I had overlooked the cyclic nature of what I had produced here and, of course, the GC can't be blamed for not collecting objects that are part of a cycle. The other question about the last refe- rence to an obj

Re: Messing with the GC

2013-01-20 Thread Jens Thoms Toerring
Hi, thank you for the explanations. I had overlooked the cyclic nature of what I had produced here and, of course, the GC can't be blamed for not collecting objects that are part of a cycle. The other question about the last refe- rence to an object vanishing within a method call (which, as I

Re: Messing with the GC

2013-01-19 Thread Steven D'Aprano
And further thoughts... On Sat, 19 Jan 2013 14:47:16 +, Jens Thoms Toerring wrote: > Hi, > >triggered by some problems I had with PySide I got a bit > confused about what the GC may do in certain situations. Here's a small > test program I cobbled together: > > import sys > > class X(

Re: Messing with the GC

2013-01-19 Thread Terry Reedy
On 1/19/2013 9:47 AM, Jens Thoms Toerring wrote: The code comments mostly answer your questions about what happens or does not happen and when. The comments after add more detail. import sys class X( object ) : def __init__( self, parent, cnt ) : print( "In constructor for {0}

Re: Messing with the GC

2013-01-19 Thread Steven D'Aprano
On Sat, 19 Jan 2013 16:24:37 +, Steven D'Aprano wrote: > On Sat, 19 Jan 2013 14:47:16 +, Jens Thoms Toerring wrote: > >> Ok, the destrucor for the first instance of the X class is called only >> after printing out "After", so the GC didn't delete the object before. >> But then there are o

Re: Messing with the GC

2013-01-19 Thread Steven D'Aprano
On Sat, 19 Jan 2013 14:47:16 +, Jens Thoms Toerring wrote: > Ok, the destrucor for the first instance of the X class is called only > after printing out "After", so the GC didn't delete the object before. > But then there are obviously no calls of the destructors of neither the > second instan

Messing with the GC

2013-01-19 Thread Jens Thoms Toerring
Hi, triggered by some problems I had with PySide I got a bit confused about what the GC may do in certain situations. Here's a small test program I cobbled together: import sys class X( object ) : def __init__( self, parent, cnt ) : print( "In constructor for {0} {1}".format( self