A weak-reference object. You construct a weak reference by passing any COM object you like. If the object does not support weak refs, you will get a standard NS_NOINTERFACE exception. Once you have a weak-reference, you can "call" the object to get back a strong reference. Eg: >>> some_ob = components.classes['...'] >>> weak_ref = WeakReference(some_ob) >>> new_ob = weak_ref() # new_ob is effectively "some_ob" at this point >>> # EXCEPT: new_ob may be None if some_ob has already died - a >>> # weak reference does not keep the object alive (that is the point) You should never hold onto this resulting strong object for a long time, or else you defeat the purpose of the weak-reference.
Public Member Functions