Re: [Tutor] How to delete a class instance

2005-03-17 Thread Kent Johnson
Kent Johnson wrote: Shitiz Bansal wrote: In the code you have shown, I don't see any need for the queue. Just create the thread and start it. I don't think you have to keep a reference to it. I'm not sure, but I think the thread will be garbage collected when it completes. (Can anyone else confi

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Shitiz Bansal
--- Danny Yoo <[EMAIL PROTECTED]> wrote: > Ok, this makes sense. Each passenger thread needs > to know about the > queue, because that's the place you want the > passenger to drop out of. > > Lists support a 'remove()' method, so you may be > able to use it. Does it operate like queue.remove(s

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Kent Johnson
Shitiz Bansal wrote: In the code you have shown, I don't see any need for the queue. Just create the thread and start it. I don't think you have to keep a reference to it. I'm not sure, but I think the thread will be garbage collected when it completes. (Can anyone else confirm this?) This does

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Danny Yoo
> --- Danny Yoo <[EMAIL PROTECTED]> wrote: > > > Ok, this makes sense. Each passenger thread needs to know about the > > queue, because that's the place you want the passenger to drop out of. > > > > Lists support a 'remove()' method, so you may be able to use it. > > Does it operate like queue.

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Shitiz Bansal
> In the code you have shown, I don't see any need for > the queue. Just create the thread and start it. > I don't think you have to keep a reference to it. > I'm not sure, but I think the thread will be > garbage collected when it completes. (Can anyone > else confirm this?) This does make se

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Kent Johnson
Shitiz Bansal wrote: No, this list is not a linked list. Since mu original code is rather huge, I am presenting the relevant snippet. queue=[] def genpassenger(num,destination,queue=queue): for i in range(num): newpass=passenger(destination) queue.append(newpass) newpass

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Danny Yoo
On Wed, 16 Mar 2005, Shitiz Bansal wrote: > No, this list is not a linked list. > Since mu original code is rather huge, I am presenting > the relevant snippet. > queue=[] > def genpassenger(num,destination,queue=queue): > for i in range(num): > newpass=passenger(destination) >

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Shitiz Bansal
No, this list is not a linked list. Since mu original code is rather huge, I am presenting the relevant snippet. queue=[] def genpassenger(num,destination,queue=queue): for i in range(num): newpass=passenger(destination) queue.append(newpass) newpass.start() class passen

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Kent Johnson
Shitiz Bansal wrote: Hi, How do i delete a class instance in a function running within itself? All the instances of the class are stored in a list, and they need to be deleted after executing their function. However since the list is dynamic, there is no way to know the exact position of the instan