Kottiyath wrote:
...
Having a registry inside the class instance and looping through them
was the only clean thing I could think of.
I understand that garbage collection would be an issue - but is there
any way out?
Search for weakref in the documentatione.
In this case, I'd use a WeakValueDict
On Dec 24, 11:48 pm, "Gabriel Genellina"
wrote:
> En Wed, 24 Dec 2008 16:18:55 -0200, Kottiyath
> escribió:
>
> >> The other thing to remember is that because the 'registry' contains
> >> references to the instances, they won't be garbage collected.
>
> > Is there any other way out in this case
En Wed, 24 Dec 2008 16:18:55 -0200, Kottiyath
escribió:
The other thing to remember is that because the 'registry' contains
references to the instances, they won't be garbage collected.
Is there any other way out in this case?
I have factory methods - and I have to loop over them - sort of
On Dec 24, 11:04 pm, MRAB wrote:
> Diez B. Roggisch wrote:
> > Kottiyath schrieb:
> >> Hi,
> >> How can I iterate over all the objects of a class?
> >> I wrote the code like following:
> >> class baseClass(object):
>
> > Consider adopting PEP 8 coding conventions.
>
> >> __registry = []
On Dec 24, 10:52 pm, "Diez B. Roggisch" wrote:
> Kottiyath schrieb:
>
> > Hi,
> > How can I iterate over all the objects of a class?
> > I wrote the code like following:
> > class baseClass(object):
>
> Consider adopting PEP 8 coding conventions.
>
>
>
> > __registry = []
>
> > def
Diez B. Roggisch wrote:
Kottiyath schrieb:
Hi,
How can I iterate over all the objects of a class?
I wrote the code like following:
class baseClass(object):
Consider adopting PEP 8 coding conventions.
__registry = []
def __init__(self, name):
self.__registry.append(se
Kottiyath schrieb:
Hi,
How can I iterate over all the objects of a class?
I wrote the code like following:
class baseClass(object):
Consider adopting PEP 8 coding conventions.
__registry = []
def __init__(self, name):
self.__registry.append(self)
self.name = n
Hi,
How can I iterate over all the objects of a class?
I wrote the code like following:
class baseClass(object):
__registry = []
def __init__(self, name):
self.__registry.append(self)
self.name = name
def __iter__(self):
baseClass.item = 0
return