jangada.mixin.Activatable.active#
- Activatable.active: bool#
Activation state flag.
Boolean indicating whether the object is enabled, active, or in effect. Useful for objects that can be toggled on/off without being destroyed. Strictly validates boolean type - does not accept truthy/falsy values.
Notes
Strict boolean validation prevents subtle bugs from truthy/falsy values. For example,
"false"would be truthy in Python, causing unexpected behavior if coercion were allowed.Use
activefor temporary enable/disable. For permanent removal, delete the object instead.The active state persists through serialization, so disabled objects remain disabled after save/load cycles.
Examples
Basic usage:
obj.active = True obj.active = False
Toggling:
obj.active = not obj.active
Strict validation:
obj.active = True # ✓ OK obj.active = False # ✓ OK obj.active = 1 # ✗ TypeError obj.active = 0 # ✗ TypeError obj.active = "true" # ✗ TypeError obj.active = None # ✗ TypeError obj.active = [] # ✗ TypeError
Conditional logic:
if obj.active: process(obj) active_objects = [o for o in objects if o.active]