Object instantiation and garbage collection

Greg Ewing see at my.signature
Wed May 16 00:45:37 EDT 2001


Van Gale wrote:
> 
>     def handle_accept(self):
>         channel, addr = self.accept()
>         TimeChannel(channel)
> 
> Doesn't this run a risk of creating an object with a reference count of 0
> which can then be garbage collected?

Presumably its __init__ method is storing a
reference to it somewhere else, e.g. adding
it to some collection or other.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list