On 1/28/2012 11:02 PM, Chris Angelico wrote:
On Sun, Jan 29, 2012 at 2:48 PM, Lee Chaplin<lchapli...@gmail.com> 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 maintain a list every time one is created. Then you just
iterate over that list to know about your friends.
To do this, just append to the list in __init__, and possibly have an
explicit "destroy" or "remove" method that will take self out of that
list.
Sets are much better for removal.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list