File: bitarray3.rst

package info (click to toggle)
python-bitarray 3.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,288 kB
  • sloc: python: 11,456; ansic: 7,657; makefile: 73; sh: 6
file content (27 lines) | stat: -rw-r--r-- 1,238 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Bitarray 3 transition
=====================

The bitarray version 3 release is bitarray's farewell to Python 2.
Apart from removing Python 2 support, this release also migrates
bitarray's ``.decode()`` and ``.search()`` methods to return iterators.
This is similar to how Python's ``dict.keys()``, ``.values()``
and ``.items()`` methods were revamped in the Python 2 to 3 transition.

In the following table, ``a`` is assumed to a bitarray object.

+----------------------+----------------------+
| before version 3     | version 3            |
+======================+======================+
| ``a.iterdecode()``   | ``a.decode()``       |
+----------------------+----------------------+
| ``a.decode()``       | ``list(a.decode()``  |
+----------------------+----------------------+
| ``a.itersearch()``   | ``a.search()``       |
+----------------------+----------------------+
| ``a.search()``       | ``list(a.search()``  |
+----------------------+----------------------+

Aside from these changes which will make bitarray 3 more pythonic, there
are a few other minor changes (see changelog).
It should be emphasized that in most common use cases the bitarray 3
transition will require only minor code changes, or no changes at all.