sietse / simpy-fsm

Explore a state machine mechanism/notation for Simpy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to pass data between states / what should the signature of every state be?

sietse opened this issue · comments

How to pass data between states / what should the signature of every state be?

Options:

  • mystate(self) -> next_state: pass data by mutating self; for CSMs (child state machines), parent sets nsm.parent = self.
  • mystate(self, obj) -> next_state: obj is the object representing the process/entity/actor: for top-level FSMs obj is self, but for CSMs obj is parent
  • mystate(self, data) -> next_state: usually obj is self, but for CSMs obj is parent
  • mystate(self, arg1, arg2, kwarg3=...) -> next_state, next_state_args, next_state_kwargs