@@ -516,7 +516,8 @@ supplied to the ``py::native_enum`` and ``py::class_`` constructors. The
516
516
into the parent scope, if desired.
517
517
518
518
``py::native_enum `` was introduced with pybind11v3. It binds C++ enum types
519
- to native Python enum types, typically types in Python's `stdlib enum `_ module,
519
+ to native Python enum types, typically types in Python's
520
+ `stdlib enum <https://docs.python.org/3/library/enum.html >`_ module,
520
521
which are `PEP 435 compatible <https://peps.python.org/pep-0435/ >`_.
521
522
This is the recommended way to bind C++ enums.
522
523
The older ``py::enum_ `` is not PEP 435 compatible
@@ -543,9 +544,12 @@ Other types can be specified like this:
543
544
py::native_enum<Pet::Kind>(pet, "Kind", "enum.IntEnum")
544
545
545
546
Any fully-qualified Python name can be specified. The only requirement is
546
- that the named type is similar to enum.Enum _ in these ways:
547
+ that the named type is similar to
548
+ `enum.Enum <https://docs.python.org/3/library/enum.html#enum.Enum >`_
549
+ in these ways:
547
550
548
- * Has a constructor similar to that of enum.Enum _::
551
+ * Has a `constructor similar to that of enum.Enum
552
+ <https://docs.python.org/3/howto/enum.html#functional-api> `_::
549
553
550
554
Colors = enum.Enum("Colors", (("Red", 0), ("Green", 1)))
551
555
@@ -559,9 +563,6 @@ that the named type is similar to enum.Enum_ in these ways:
559
563
560
564
underlying = red.value
561
565
562
- .. _`stdlib enum` : https://docs.python.org/3/library/enum.html
563
- .. _enum.Enum : https://docs.python.org/3/library/enum.html#enum.Enum
564
-
565
566
.. note ::
566
567
567
568
In rare cases, a C++ enum may be bound to Python via a
0 commit comments