Skip to content

using StrEnum instead of Enum #4351

@wyli

Description

@wyli

Is your feature request related to a problem? Please describe.
StrEnum (new in py3.11 https://docs.python.org/3.11/library/enum.html#enum.StrEnum) "is the same as Enum, but its members are also strings and can be used in most of the same places that a string can be used."

this is a feature request for incorporating this class which will hopefully simplify the codebase in many places such as

mode: Union[NumpyPadMode, PytorchPadMode, str] = NumpyPadMode.CONSTANT,

however StrEnum is not available for other versions of python that monai supports, some customized class should be introduced. see also the discussion https://discuss.python.org/t/built-in-strenum/4192

cc @SachidanandAlle

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions