Skip to content

Commit 14ac2a1

Browse files
committed
add release date - update docs
1 parent d3f0eca commit 14ac2a1

File tree

4 files changed

+65
-38
lines changed

4 files changed

+65
-38
lines changed

CHANGE_LOG

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
2025-08-XX 3.7.0:
1+
2025-08-24 3.7.0:
22
-------------------
33
* add `util.gen_primes()`, generate bitarrays in which active indices are
44
prime numbers
55
* improve `.buffer_info()` to return named tuple
6-
* add optional `mode` argument to `util.sum_indices()`
6+
* add optional `mode` argument to `util.sum_indices()` to sum square of
7+
active indices
78
* improve internal `_sysinfo()` to include `Py_DEBUG`
89
* add [Dubner's conjecture](../examples/dubner.rst) (in memory of Harvey
910
Dubner)

README.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Key features
2727
* Immutable ``frozenbitarray`` objects which are hashable
2828
* Sequential search
2929
* Type hinting
30-
* Extensive test suite with over 500 unittests
30+
* Extensive test suite with about 600 unittests
3131
* Utility module ``bitarray.util``:
3232

3333
* conversion to and from hexadecimal strings
@@ -66,12 +66,13 @@ Once you have installed the package, you may want to test it:
6666
HAVE_BUILTIN_BSWAP64: 1
6767
default bit-endianness: big
6868
machine byte-order: little
69-
debug build: 0
69+
Py_DEBUG: 0
70+
DEBUG: 0
7071
.........................................................................
7172
.........................................................................
7273
................................................................
7374
----------------------------------------------------------------------
74-
Ran 596 tests in 0.166s
75+
Ran 599 tests in 0.166s
7576
7677
OK
7778

doc/changelog.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
Change log
22
==========
33

4+
**3.7.0** (2025-08-24):
5+
6+
* add ``util.gen_primes()``, generate bitarrays in which active indices are
7+
prime numbers
8+
* improve ``.buffer_info()`` to return named tuple
9+
* add optional ``mode`` argument to ``util.sum_indices()`` to sum square of
10+
active indices
11+
* improve internal ``_sysinfo()`` to include ``Py_DEBUG``
12+
* add `Dubner's conjecture <../examples/dubner.rst>`__ (in memory of Harvey
13+
Dubner)
14+
* add `dynamically growing sieve <../examples/dyn_sieve.rst>`__
15+
16+
417
**3.6.1** (2025-08-12):
518

619
* add development files for statistical tests in ``devel/random/``

doc/reference.rst

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Reference
22
=========
33

4-
bitarray version: 3.6.1 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
4+
bitarray version: 3.7.0 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
55

66
In the following, ``item`` and ``value`` are usually a single bit -
77
an integer 0 or 1.
@@ -40,34 +40,36 @@ bitarray methods:
4040
-----------------
4141

4242
``all()`` -> bool
43-
Return True when all bits in bitarray are True.
44-
Note that ``a.all()`` is faster than ``all(a)``.
43+
Return ``True`` when all bits in bitarray are 1.
44+
``a.all()`` is a faster version of ``all(a)``.
4545

4646

4747
``any()`` -> bool
48-
Return True when any bit in bitarray is True.
49-
Note that ``a.any()`` is faster than ``any(a)``.
48+
Return ``True`` when any bit in bitarray is 1.
49+
``a.any()`` is a faster version of ``any(a)``.
5050

5151

5252
``append(item, /)``
5353
Append ``item`` to the end of the bitarray.
5454

5555

56-
``buffer_info()`` -> tuple
57-
Return a tuple containing:
56+
``buffer_info()`` -> BufferInfo
57+
Return named tuple with following fields:
5858

59-
0. memory address of buffer
60-
1. buffer size (in bytes)
61-
2. bit-endianness as a Unicode string
62-
3. number of pad bits
63-
4. allocated memory for the buffer (in bytes)
64-
5. memory is read-only
65-
6. buffer is imported
66-
7. number of buffer exports
59+
0. ``address``: memory address of buffer
60+
1. ``nbytes``: buffer size (in bytes)
61+
2. ``endian``: bit-endianness as a string
62+
3. ``padbits``: number of pad bits
63+
4. ``alloc``: allocated memory for buffer (in bytes)
64+
5. ``readonly``: memory is read-only (bool)
65+
6. ``imported``: buffer is imported (bool)
66+
7. ``exports``: number of buffer exports
67+
68+
New in version 3.7: return named tuple
6769

6870

6971
``bytereverse(start=0, stop=<end of buffer>, /)``
70-
For each byte in byte-range(start, stop) reverse bits in-place.
72+
For each byte in byte-range(``start``, ``stop``) reverse bits in-place.
7173
The start and stop indices are given in terms of bytes (not bits).
7274
Also note that this method only changes the buffer; it does not change the
7375
bit-endianness of the bitarray object. Pad bits are left unchanged such
@@ -77,13 +79,13 @@ bitarray methods:
7779

7880

7981
``clear()``
80-
Remove all items from the bitarray.
82+
Remove all items from bitarray.
8183

8284
New in version 1.4
8385

8486

8587
``copy()`` -> bitarray
86-
Return a copy of the bitarray.
88+
Return copy of bitarray (with same bit-endianness).
8789

8890

8991
``count(value=1, start=0, stop=<end>, step=1, /)`` -> int
@@ -119,7 +121,7 @@ bitarray methods:
119121

120122
``extend(iterable, /)``
121123
Append items from to the end of the bitarray.
122-
If ``iterable`` is a Unicode string, each ``0`` and ``1`` are appended as
124+
If ``iterable`` is a (Unicode) string, each ``0`` and ``1`` are appended as
123125
bits (ignoring whitespace and underscore).
124126

125127
New in version 3.4: allow ``bytes`` object
@@ -159,7 +161,7 @@ bitarray methods:
159161
``index(sub_bitarray, start=0, stop=<end>, /, right=False)`` -> int
160162
Return lowest (or rightmost when ``right=True``) index where sub_bitarray
161163
is found, such that sub_bitarray is contained within ``[start:stop]``.
162-
Raises ``ValueError`` when the sub_bitarray is not present.
164+
Raises ``ValueError`` when sub_bitarray is not present.
163165

164166
New in version 2.9: add optional keyword argument ``right``
165167

@@ -170,7 +172,7 @@ bitarray methods:
170172

171173
``invert(index=<all bits>, /)``
172174
Invert all bits in bitarray (in-place).
173-
When the optional ``index`` is given, only invert the single bit at index.
175+
When the optional ``index`` is given, only invert the single bit at ``index``.
174176

175177
New in version 1.5.3: optional index argument
176178

@@ -225,7 +227,7 @@ bitarray methods:
225227

226228

227229
``to01(group=0, sep=' ')`` -> str
228-
Return bitarray as Unicode string of '0's and '1's.
230+
Return bitarray as (Unicode) string of ``0``s and ``1``s.
229231
The bits are grouped into ``group`` bits (default is no grouping).
230232
When grouped, the string ``sep`` is inserted between groups
231233
of ``group`` characters, default is a space.
@@ -234,11 +236,11 @@ bitarray methods:
234236

235237

236238
``tobytes()`` -> bytes
237-
Return the bitarray buffer in bytes (pad bits are set to zero).
239+
Return the bitarray buffer (pad bits are set to zero).
238240

239241

240242
``tofile(f, /)``
241-
Write byte representation of bitarray to file object f.
243+
Write bitarray buffer to file object ``f``.
242244

243245

244246
``tolist()`` -> list
@@ -312,7 +314,7 @@ Functions defined in the `bitarray` module:
312314

313315

314316
``test(verbosity=1)`` -> TextTestResult
315-
Run self-test, and return unittest.runner.TextTestResult object.
317+
Run self-test, and return ``unittest.runner.TextTestResult`` object.
316318

317319

318320
Functions defined in `bitarray.util` module:
@@ -370,7 +372,7 @@ This sub-module was added in version 1.2.
370372
New in version 3.3: ignore whitespace
371373

372374

373-
``byteswap(a, /, n=<buffer size>)``
375+
``byteswap(a, n=<buffer size>, /)``
374376
Reverse every ``n`` consecutive bytes of ``a`` in-place.
375377
By default, all bytes are reversed. Note that ``n`` is not limited to 2, 4
376378
or 8, but can be any positive integer.
@@ -446,6 +448,15 @@ This sub-module was added in version 1.2.
446448
New in version 2.5.0: allow bytes-like argument
447449

448450

451+
``gen_primes(n, /, endian=None, odd=False)`` -> bitarray
452+
Generate a bitarray of length ``n`` in which active indices are prime numbers.
453+
By default (``odd=False``), active indices correspond to prime numbers directly.
454+
When ``odd=True``, only odd prime numbers are represented in the resulting
455+
bitarray ``a``, and ``a[i]`` corresponds to ``2*i+1`` being prime or not.
456+
457+
New in version 3.7
458+
459+
449460
``hex2ba(hexstr, /, endian=None)`` -> bitarray
450461
Bitarray of hexadecimal representation. hexstr may contain any number
451462
(including odd numbers) of hex digits (upper or lower case).
@@ -493,11 +504,9 @@ This sub-module was added in version 1.2.
493504

494505

495506
``pprint(bitarray, /, stream=None, group=8, indent=4, width=80)``
496-
Prints the formatted representation of object on ``stream`` (which defaults
497-
to ``sys.stdout``). By default, elements are grouped in bytes (8 elements),
498-
and 8 bytes (64 elements) per line.
499-
Non-bitarray objects are printed by the standard library
500-
function ``pprint.pprint()``.
507+
Pretty-print bitarray object to ``stream``, defaults is ``sys.stdout``.
508+
By default, bits are grouped in bytes (8 bits), and 64 bits per line.
509+
Non-bitarray objects are printed using ``pprint.pprint()``.
501510

502511
New in version 1.8
503512

@@ -532,7 +541,7 @@ This sub-module was added in version 1.2.
532541
New in version 3.5
533542

534543

535-
``sc_decode(stream)`` -> bitarray
544+
``sc_decode(stream, /)`` -> bitarray
536545
Decompress binary stream (an integer iterator, or bytes-like object) of a
537546
sparse compressed (``sc``) bitarray, and return the decoded bitarray.
538547
This function consumes only one bitarray and leaves the remaining stream
@@ -575,12 +584,15 @@ This sub-module was added in version 1.2.
575584
iteration is stopped as soon as one mismatch is found.
576585

577586

578-
``sum_indices(a, /)`` -> int
587+
``sum_indices(a, /, mode=1)`` -> int
579588
Return sum of indices of all active bits in bitarray ``a``.
580589
Equivalent to ``sum(i for i, v in enumerate(a) if v)``.
590+
``mode=2`` sums square of indices.
581591

582592
New in version 3.6
583593

594+
New in version 3.7: add optional mode argument
595+
584596

585597
``urandom(n, /, endian=None)`` -> bitarray
586598
Return random bitarray of length ``n`` (uses ``os.urandom()``).

0 commit comments

Comments
 (0)