- Python State Machine version: 2.4.0
- Python version: Python 3.10.12
- Operating System: Ubuntu 20.04
Description
This is a simple example: Given states and transitions, I want to transition from state 1 (It could be 3 as well), to either 2 or 3 (respective states 0 or F). I am unable to find API method for this action. The example and diagram follow below.
I undestand it is a misuse of my part since I am able to define single state-to-state instead of or-defined transition coupling. I mean, it is not a library flaw, but also too trivial to be mistake by other library users. I ask politely to disconsider our previous conflicts, I come in peace. In my opinion, it answers the issue #494 as well

What I Did
Code:
from statemachine import StateMachine, State
class MyStateMachine(StateMachine):
# States
S0 = State(initial=True)
S1 = State()
S2 = State()
S3 = State()
SF = State(final=True)
# Transitions
T0_1 = S0.to(S1)
T1_23 = S1.to(S3) | S1.to(S2)
T2_3F = S2.to(S3) | S2.to(SF)
T3_0F = S3.to(S0) | S1.to(SF)
msm=MyStateMachine()
print_at_map=lambda state: print(f"You are at state {msm.current_state}")
print_at_map(msm.current_state)
msm.send('T0_1')
print_at_map(msm.current_state)
msm.send('T1_23')
print_at_map(msm.current_state)
msm.send('T3_0F')
print_at_map(msm.current_state)
Output:
You are at state S0
You are at state S1
You are at state S3
You are at state S0
Description
This is a simple example: Given states and transitions, I want to transition from state 1 (It could be 3 as well), to either 2 or 3 (respective states 0 or F). I am unable to find API method for this action. The example and diagram follow below.
I undestand it is a misuse of my part since I am able to define single state-to-state instead of or-defined transition coupling. I mean, it is not a library flaw, but also too trivial to be mistake by other library users. I ask politely to disconsider our previous conflicts, I come in peace. In my opinion, it answers the issue #494 as well
What I Did
Code:
Output: