Is `_sort_order_` of the `enum.Enum` safe to use?

This is not documented anywhere, and instead I see countless hacks for making enum.StrEnum orderable. On the other hand, if we use the _sort_order_ then it is easier

class Example(enum.StrEnum):
    FOO = enum.auto()
    BAR = enum.auto()

    def __gt__(self, other):
        return self._sort_order_ > other._sort_order_

But would this be safe to use for the long term? Should it not be documented in that case? Is there something more complicated in the _sort_order_ that is being missed?

Looking at the source code I don’t see StrEnum having an _sort_order_ method.

It is well hidden cpython/Lib/enum.py at 82c62abc4538e371c976658bc4444c8834c01dcc · python/cpython · GitHub. It does appear in __dict__ though, and you can try to use it and it works worryingly well

It’s on all enums, not just StrEnum; it’s set externally on newly-created members.

It looks a bit hacky, but if x.y.z+1 enum changes, you can copy enun x.y.z enum into your project.