InstanceTrackerSet class¶

(Shortest import: from brian2.core.tracking import InstanceTrackerSet)

class brian2.core.tracking.InstanceTrackerSet[source]

Bases: set

A set of weakref.ref to all existing objects of a certain class.

Should not normally be directly used.

Methods

 add(value) Adds a weakref.ref to the value remove(value) Removes the value (which should be a weakref) if it is in the set

Details

add(value)[source]

Adds a weakref.ref to the value

remove(value)[source]

Removes the value (which should be a weakref) if it is in the set

Sometimes the value will have been removed from the set by clear, so we ignore KeyError in this case.