Re: Get all the instances of one class

2008-05-19 Thread Nick Craig-Wood
Matt Nordhoff <[EMAIL PROTECTED]> wrote: > Tommy Nordgren wrote: > > class MyClass : a_base_class > > memberlist=[] > > > > # Insert object in memberlist when created; > > # note: objects won't be garbage collected until removed from memberlist. > > Just to say, if you wanted to go abou

Re: Get all the instances of one class

2008-05-18 Thread Matt Nordhoff
Tommy Nordgren wrote: > class MyClass : a_base_class > memberlist=[] > > # Insert object in memberlist when created; > # note: objects won't be garbage collected until removed from memberlist. Just to say, if you wanted to go about it that way, you could avoid the garbage collection probl

Re: Get all the instances of one class

2008-05-18 Thread Terry
On May 18, 11:35 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Terry schrieb: > > > > > On May 17, 8:04 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > > wrote: > >> En Fri, 16 May 2008 20:44:00 -0300, Terry <[EMAIL PROTECTED]> > >> escribió: > > >>> Is there a simple way to get all the instanc

Re: Get all the instances of one class

2008-05-18 Thread Tommy Nordgren
On 17 maj 2008, at 01.44, Terry wrote: Hi, Is there a simple way to get all the instances of one class? I mean without any additional change to the class. br, Terry -- http://mail.python.org/mailman/listinfo/python-list class MyClass : a_base_class memberlist=[] # Insert object in

Re: Get all the instances of one class

2008-05-18 Thread Gabriel Genellina
En Sun, 18 May 2008 12:32:28 -0300, Terry <[EMAIL PROTECTED]> escribió: > On May 17, 8:04 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> En Fri, 16 May 2008 20:44:00 -0300, Terry <[EMAIL PROTECTED]> >> escribió: >> >> > Is there a simple way to get all the instances of one class? I mean >

Re: Get all the instances of one class

2008-05-18 Thread Diez B. Roggisch
Terry schrieb: On May 17, 8:04 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: En Fri, 16 May 2008 20:44:00 -0300, Terry <[EMAIL PROTECTED]> escribió: Is there a simple way to get all the instances of one class? I mean without any additional change to the class. Try with gc.get_referrers()

Re: Get all the instances of one class

2008-05-18 Thread Terry
On May 17, 8:04 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 16 May 2008 20:44:00 -0300, Terry <[EMAIL PROTECTED]> > escribió: > > > Is there a simple way to get all the instances of one class? I mean > > without any additional change to the class. > > Try with gc.get_referrers() >

Re: Get all the instances of one class

2008-05-18 Thread Terry
On May 17, 8:04 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 16 May 2008 20:44:00 -0300, Terry <[EMAIL PROTECTED]> > escribió: > > > Is there a simple way to get all the instances of one class? I mean > > without any additional change to the class. > > Try with gc.get_referrers() >

Re: Get all the instances of one class

2008-05-16 Thread Gabriel Genellina
En Fri, 16 May 2008 20:44:00 -0300, Terry <[EMAIL PROTECTED]> escribió: Is there a simple way to get all the instances of one class? I mean without any additional change to the class. Try with gc.get_referrers() py> import gc py> class A(object): pass ... py> a,b,c = A(),A(),A() py> A py>

Re: Get all the instances of one class

2008-05-16 Thread Ben Finney
Terry <[EMAIL PROTECTED]> writes: > Is there a simple way to get all the instances of one class? Define "all". All the instances in the current scope? Perhaps more pertinent: What problem are you trying to address? -- \ “We demand rigidly defined areas of doubt and uncertainty!” | `