We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 730c524 commit 32e6f34Copy full SHA for 32e6f34
1 file changed
doc/indexing.rst
@@ -64,6 +64,17 @@ considered masks. For example:
64
Note that ``del a[mask]`` is equivalent to the in-place version of
65
selecting the reverse mask ``a = a[~mask]``.
66
67
-Also note that masked assignment is not implemented,
+As of bitarray version 3.1, masked assignment to bitarrays is also
68
+supported:
69
+
70
+.. code-block:: python
71
72
+ >>> a = bitarray('1001001')
73
+ >>> mask = bitarray('1010111')
74
+ >>> a[mask] = bitarray("11100")
75
+ >>> a
76
+ bitarray('1011100')
77
78
+However, masked assignment to Booleans is not implemented,
79
as ``a[mask] = 1`` would be equivalent to the bitwise operation ``a |= mask``.
80
And ``a[mask] = 0`` would be equivalent to ``a &= ~mask``.
0 commit comments