Skip to content

Guards and conditions passed as strings really necessary? #417

@svenwanzenried

Description

@svenwanzenried
  • Python State Machine version: 2.1.2
  • Python version: 3.11.4
  • Operating System: Windows 10

Description

I wonder why we have to give the "unless" parameter and similar as strings. It hinders me from using automatic renaming in my IDE which does not recognize function names as strings.

What I Did

So what I am using currently is following hack:

step |= measure_spot_center.to(move_spot_center, unless=spot_center_ok.__name__)

Using __name__ to pass a string just to be resolved back to the functions feels very unnerving to do.
Is there a reason, why this has to be that way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions