Any ideas how to achieve this strategy, I don’t really care about the complexity of what happens under the hood (as long as I don’t have to install weird packages), I just want the code to read cleanly like this …
Ideally I would have this block in one of two states :
<Inactive>
#DO2; for i in range (start4, start4+duration4):
#DO2; X4[:,i] = state_process4.update()
<Active>
DO2; for i in range (start4, start4+duration4):
DO2; X4[:,i] = state_process4.update()
where I had thought a simple def would work
def DO2(): # execute all these prev commented out steps, to remove simply conv. DO2 to #DO2
pass
However there seems no way to precede the “for” with anything but a # comment
I’ve been led down the garden path to something close like this, but the parser still
complains about the “for” being invalid syntax
def DO22(func):
def wrapper(*args, **kwargs):
pass
return wrapper
# later in code
@DO22
for i in range (start4, start4+duration4):
DO2; X4[:,i] = state_process4.update()
for i in range (start4, start4+duration4):
^^^
SyntaxError: invalid syntax