bitarray

  729 downloads
0.7.0 Python License    
  not rated
efficient arrays of booleans -- C extension

description

download

specifications

changelog

bitarray is a Python module that provides an object type which efficiently represents an array of booleans. Bitarrays are sequence types and behave very much like usual lists. Eight bits are represented by one byte in contiguous block of memory. The user can select between two representations; little-endian and big-endian. Most of the functionality is implemented in C. Methods for accessing the machine representation are provided. This can be useful when bit level access to binary files is required, such as portable bitmap image files (.pbm). Also, when dealing with compressed data which uses variable bit length encoding, you may find this module useful.

Installation:

bitarray can be installed from source:

$ tar xzf bitarray-0.3.3.tar.gz
$ cd bitarray-0.3.3
$ python setup.py install


On Unix systems, the latter command may have to be executed with root privileges. If you have setuptools installed, you can easy_install bitarray. Once you have installed the package, you may want to test it:

$ python -c 'import bitarray; bitarray.test()'
bitarray is installed in: /usr/local/lib/python2.5/site-packages/bitarray
bitarray version: 0.3.3
2.5.2 (r252:60911, Jul 17 2008, 10:38:24)
[GCC 4.2.1 (SUSE Linux)]
.........................................................................
..........
----------------------------------------------------------------------
Ran 90 tests in 2.420s

OK


You can always import the function test, and test().wasSuccessful() will return True when the test went OK.
READ MORE   
Last updated on February 16th, 2012

0 User reviews so far.

SUBMIT