pynbody.util.ExecutionControl#
- class pynbody.util.ExecutionControl[source]#
Bases:
objectClass to control execution flow in a with statement.
For example, one may use this to control whether a block of code should be executed or not, based on some condition which is externally controlled at runtime.
Example:
c = ExecutionControl() with c: if c: print("This will be executed") if c: print("This will not be executed")
This is used for implementing the various execution control mechanisms in
pynbody.snapshot.simsnap.SimSnap.