Deleting objects with method reference

Jeff Epler jepler at unpythonic.net
Thu Apr 15 07:53:17 EDT 2004


It works here when I call gc.collect().  There's not exactly a guarantee
about when garbage will be collected otherwise.
>>> o2 = B()
>>> o2.Set()
>>> w2 = weakref.ref(o2, ondel)
>>> del o2
>>> gc.collect()
del
3

Jeff




More information about the Python-list mailing list