docs/{guide,reference}: clarify semantics of a.any() vs a.bool().

This commit is contained in:
Catherine 2024-04-03 08:39:45 +00:00
parent 3c6f46717b
commit 967dabc2fe
2 changed files with 10 additions and 5 deletions

View file

@ -622,7 +622,8 @@ class Value(metaclass=ABCMeta):
def bool(self):
"""Conversion to boolean.
Performs the same operation as :meth:`any`.
Returns the same value as :meth:`any`, but should be used where :py:`self` is semantically
a number.
Returns
-------
@ -934,6 +935,9 @@ class Value(metaclass=ABCMeta):
def any(self):
"""Reduction OR; is any bit :py:`1`?
Performs the same operation as :meth:`bool`, but should be used where :py:`self` is
semantically a bit sequence.
Returns
-------
:class:`Value`, :py:`unsigned(1)`
@ -2072,7 +2076,7 @@ class Signal(Value, DUID, metaclass=_SignalMeta):
if decoder is not None:
# The value representation is specified explicitly. Since we do not expose `hdl._repr`,
# this is the only way to add a custom filter to the signal right now.
# this is the only way to add a custom filter to the signal right now.
if isinstance(decoder, type) and issubclass(decoder, Enum):
self._value_repr = (_repr.Repr(_repr.FormatEnum(decoder), self),)
else: