Skip to content

Conversation

@KommuSoft
Copy link
Contributor

Currently when using if my_fsm, it will fallback on __len__ which will raise an OverflowError in case there are an infinite many strings that match the FSM.

We can just check if the FSM is empty. This is "equivalent" with the current implementation in the sense that for FSMs that accept a finite number of strings, the bool will be the same for both versions, but by adding a __bool__ we will also return True if an infinite amount of strings are accepted, and it is less computationally expensive.

@MegaIng
Copy link
Owner

MegaIng commented Mar 6, 2024

Is the library doing if fsm somewhere? Otherwise, use greenery instead. For interegular FSM is really just an internal detail, and I want to move over to just using greenery.fsm.FSM at some point to reduce complexity of this package. Their implementation is also just better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants