Skip to content

Commit f819930

Browse files
committed
add sentence
1 parent dcc1b21 commit f819930

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

doc/endianness.rst

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,22 @@ the bitarray it is provided with:
124124
125125
The same behavior is valid for ``hex2ba()``, ``ba2hex()``, ``base2ba()``
126126
and ``ba2base()``. Regardless of bit-endianness, these are always
127-
inverse functions to each other:
127+
inverse functions of each other:
128128

129129
.. code-block:: python
130130
131131
>>> from bitarray.util import ba2hex, hex2ba, ba2base, base2ba
132132
>>> for endian in "little", "big":
133133
... a = bitarray("1010 0011 1110", endian)
134-
... assert hex2ba(ba2hex(a), endian) == a
135-
... assert base2ba(64, ba2base(64, a), endian) == a
136-
... assert int2ba(ba2int(a), len(a), endian) == a
134+
... assert int2ba(ba2int(a), len(a), a.endian) == a
135+
... assert hex2ba(ba2hex(a), a.endian) == a
136+
... assert base2ba(64, ba2base(64, a), a.endian) == a
137+
138+
or:
139+
140+
.. code-block:: python
141+
142+
>>> for endian in "little", "big":
143+
... assert ba2int(int2ba(29, endian=endian)) == 29
144+
... assert ba2hex(hex2ba("e7a", endian)) == "e7a"
145+
... assert ba2base(64, base2ba(64, "h+E7", endian)) == "h+E7"

0 commit comments

Comments
 (0)