tomer filiba wrote: > you can solve the problem using > weakref.proxy > ... > so why not do this automatically?
I would *not* want to have some of my references chosen at random and automatically made into weak ones. I may temporarily create a cycle and later break it by removing one of the references. If the other remaining reference had been picked for auto-conversion into a weak reference, I would lose the last reference to my object. (Besides being undesirable, it would also be extremely difficult to implement efficiently.) What might be useful is an easier way of *explicitly* creating and using weak references. We already have WeakKeyDictionary and WeakValueDictionary which behave just like ordinary dicts except that they weakly reference things. I'm thinking it would be nice to have a way of declaring any attribute to be a weak reference. Then it could be read and written it in the usual way, without all the code that uses it having to know about its weakness. This could probably be done fairly easily with a suitable property descriptor. -- Greg _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com