Skip to content

Commit cfd4f9c

Browse files
committed
docs/enum: emphasize that shape= is optional.
1 parent f95fe45 commit cfd4f9c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/stdlib/enum.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,17 @@ Any :ref:`constant-castable <lang-constcasting>` expression can be used as the v
4545
>>> Instr.SUBI
4646
<Instr.SUBI: 17>
4747

48-
This module is a drop-in replacement for the standard :mod:`enum` module, and re-exports all of its members (not just the ones described below). In an Amaranth project, all ``import enum`` statements may be replaced with ``from amaranth.lib import enum``.
48+
The ``shape=`` argument is optional. If not specified, classes from this module behave exactly the same as classes from the standard :mod:`enum` module, and likewise, this module re-exports everything exported by the standard :mod:`enum` module.
49+
50+
.. testcode::
51+
52+
import amaranth.lib.enum
53+
54+
class NormalEnum(amaranth.lib.enum.Enum):
55+
SPAM = 0
56+
HAM = 1
57+
58+
In this way, this module is a drop-in replacement for the standard :mod:`enum` module, and in an Amaranth project, all ``import enum`` statements may be replaced with ``from amaranth.lib import enum``.
4959

5060

5161
Metaclass

0 commit comments

Comments
 (0)