Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!


Project Description
BitMap for python

This package provides a `BitMap` class which is an array of bits stored in compact format.

# Installation

`bitmap` can be installed from `pip`:

$ sudo pip install bitmap

# Functions

- `BitMap(maxnum)`: construct a `BitMap` object with `maxnum` bits
- `set(pos)`: set the bit at position `pos` to 1
- `reset(pos)`: reset the bit at position `pos` to 1
- `flip(pos)`: flip the bit at position `pos`
- `count()`: return the number of 1s
- `size()`: return the size of the `BitMap`
- `test(pos)`: check if bit at position `pos` has been set to 1
- `any()`: check if any bit in the `BitMap` has been set to 1
- `none()`: check if none of the bits in the `BitMap` has been set to 1
- `all()`: check if all bits in the `BitMap` has been set to 1
- `nonzero()`: return indexes of all non-zero bits
- `tostring()`: convert a `BitMap` object to `0` and `1` string
- `fromstring(bitstring)`: create a `BitMap` object from `0` and `1` string

# Examples

from bitmap import BitMap
bm = BitMap(32)
print bm.tostring()
print bm.tostring()

bm = BitMap.fromstring("00011101")
print bm.tostring()
print bm.tostring()
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
bitmap-0.0.6.tar.gz (3.2 kB) Copy SHA256 Checksum SHA256 Source Oct 28, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting