Re: class that keeps track of instances

2007-09-17 Thread yosuke
[EMAIL PROTECTED] wrote: > I want to have a class in my python application that does not allow > multiple instance with same "name". Thank you very much for very quick and precise answers to my questions! input for garbage collector and id are appreciated as well. I head to bookstore for the c

Re: class that keeps track of instances

2007-09-17 Thread Gabriel Genellina
On 17 sep, 19:10, <[EMAIL PROTECTED]> wrote: > I'd like some advices from more experienced python users. I want to > have a class in my python application that does not allow multiple > instance with same "name". > > I want to have a class (call it kls) that behave at least following way: > > 1

Re: class that keeps track of instances

2007-09-17 Thread Hrvoje Niksic
<[EMAIL PROTECTED]> writes: > 1) New instance has to have a property called 'name' > 2) When instance is attemped to created, e.g., x=kls(name='myname'), and > there already exists an instance with obj.name =='myname', that > pre-existing instance is returned, instead of making new one. > 3) A c

class that keeps track of instances

2007-09-17 Thread yosuke
Hello all, I'd like some advices from more experienced python users. I want to have a class in my python application that does not allow multiple instance with same "name". I want to have a class (call it kls) that behave at least following way: 1) New instance has to have a property called '