On Sun, Jan 29, 2012 at 1:47 AM, Lee wrote:
> I was afraid that a list/set/dictionary and alike is the answer, but,
> anyway, thanks everybody.
>
>
It doesn't seem too bad to keep track of the instances in the class object
using weak references (http://docs.python.org/py3k/library/weakref.html).
On Sun, Jan 29, 2012 at 4:12 PM, Terry Reedy wrote:
> On 1/28/2012 11:02 PM, Chris Angelico wrote:
>>
>> If you're looking only at other objects of the same class, the easiest
>> way is to maintain a list every time one is created. Then you just
>> iterate over that list to know about your friends
On 1/28/2012 11:02 PM, Chris Angelico wrote:
On Sun, Jan 29, 2012 at 2:48 PM, Lee Chaplin wrote:
I am trying to create an object that is aware of other objects created
before itself, and when found, then copy some attributes from them,
something like:
If you're looking only at other objects o
On Sun, 29 Jan 2012 16:48:34 +1300, Lee Chaplin wrote:
[...]
> The last four lines work if they are in the same module as the class
> definitions (a000), but it doesn't work if they are called from a
> different module, say:
globals() is not actually global to the entire Python session. It
actua
On Sun, Jan 29, 2012 at 2:48 PM, Lee Chaplin wrote:
> I am trying to create an object that is aware of other objects created
> before itself, and when found, then copy some attributes from them,
> something like:
If you're looking only at other objects of the same class, the easiest
way is to mai
Hi all,
I am trying to create an object that is aware of other objects created
before itself, and when found, then copy some attributes from them,
something like:
class A:
def __init__(self):
self.myname = "IamA"
print 'This is A'
def foo(self):
print "foo"
def