On Fri, 2006-10-20 at 13:44 -0500, shawn bright wrote:
> if i name them, like bob = group.Group(some_id) ?
> 
> what is going to happen is that each time, the variable will create a
> different object
> 
> like 
> while 1:
>     group = group.Group(some_id)
>     do some stuff with group. 
> 
> so since it keeps getting replaced, it should be ok without some way
> to destroy it ?

You can verify this by putting some kind of signal in the __del__
method.  For instance:

>>> class A:
...     def __del__(self): print "destroyed"
...
>>> bob = A()
>>> bob = A()
destroyed
>>> dir()
['A', '__builtins__', '__doc__', '__name__', 'bob']


So you can see that binding the name "bob" to a different instance
resulted in destroying the first one.

>
> 
> thanks
> 
> 
> On 10/20/06, Simon Brunning <[EMAIL PROTECTED]> wrote:
>         On 10/20/06, shawn bright <[EMAIL PROTECTED]> wrote:
>         > oh, one more thing.
>         > these objects are going to be created at the rate of about
>         20 / minute in a
>         > thread.
>         > at some point is this going to be a problem ? do they go
>         away over time? 
>         > Or do i need to write something that will kill them?
>         
>         If you don't keep references too them (i.e. by having names
>         that are
>         bound to them, or by keeping them in collections) then they'll
>         go away
>         - usually as soon as the last reference to them is gone. 
>         
>         --
>         Cheers,
>         Simon B
>         [EMAIL PROTECTED]
>         http://www.brunningonline.net/simon/blog/
>         _______________________________________________ 
>         Tutor maillist  -  Tutor@python.org
>         http://mail.python.org/mailman/listinfo/tutor
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
-- 
Lloyd Kvam
Venix Corp

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to