weakref_property_simple
- PlasmaCalcs.tools.properties.weakref_property_simple(internal_attr, doc=None)
defines a property which behaves like the value it contains, but is actually a weakref.
stores internally at internal_attr. Also set self.{internal_attr}_is_weakref = True.Setting the value actually creates a weakref. Getting the value calls the weakref.- Note: if failing to create weakref due to TypeError,
- (e.g. “TypeError: cannot create weak reference to ‘int’ object”)then just store the value itself. Also set self.{internal_attr}_is_weakref = False.