Method to know if object support being weakreferenced ?

Gregory Ewing greg.ewing at
Tue Dec 13 01:21:45 EST 2016

Matthias Bussonnier wrote:
> I search for a method
> capable of telling me whether an object can be weakreferenced.

Objects that can be weakly referenced have a __weakref__ attribute.
So you could use hasattr(obj, '__weakref__').


More information about the Python-list mailing list