Skip to content

ENH: use the match operator once python 3.9 is no longer supported #725

@Gui-FernandesBR

Description

@Gui-FernandesBR

Is your feature request related to a problem? Please describe.

Python 3.10, when released in 2021, introduced the match pattern operator, which is an equivalent to switchers that we see in other languages. This pattern was something the community asked for years, and since released it helped developers to make switchers chains on Python with having to define

On rocketpy, we suffer from the same problem... Take a look at this example:
image

Having a bunch of elifs is something not deseireable. Using a switcher give a cleaner view, just like this:
image

Describe the solution you'd like

  • Use the python match operator to replace if/elif/else chains in the code. We have to first evaluate if there will be an improvement in terms of code clearaity. In my experience, it usually makes the code reaaaally cleaner!

Additional context

Once we implement such "feature", we have to upgrade the minimum python version for running rocketpy to 3.10.
Therefore, this issue should be kept waiting until October 2025, when Python 3.9 will finally become a dead python version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions