Skip to content

Supporting abstract classes #344

Closed Answered by fgmacedo
galhyt asked this question in Q&A
Jan 30, 2023 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @galhyt, thanks for reporting this.

Can you provide a context of how you're using this intermediate class, for my education? I want to understand the use case.

I'll think about how to suppress the validation on classes that do not have any state and transition as an "abstract" class.

Alternatives

While we don't have this new release, I think that you can alternatively use two options.

Consider this class as the one that currently is your base class using inheritance, and It holds the custom behavior you wanna share:

class MyCustomBehavior:
    def on_enter_state(self):
        pass

Mixins

You can use this class as a mixin (multiple inheritances):

class MyConcreteStateMachine(StateMachine

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@fgmacedo
Comment options

Answer selected by fgmacedo
Comment options

You must be logged in to vote
1 reply
@fgmacedo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants