An open API service indexing awesome lists of open source software.

https://github.com/bmoscon/bit_array

Pure Python Bit Array
https://github.com/bmoscon/bit_array

Last synced: 7 months ago
JSON representation

Pure Python Bit Array

Awesome Lists containing this project

README

          

# Bit Array

[![Travis CI](https://travis-ci.org/bmoscon/bit_array.svg?branch=master)](https://travis-ci.org/bmoscon/bit_array)
[![License](https://img.shields.io/badge/license-XFree86-blue.svg)](LICENSE)

A simple bit array in pure python. Sample use:

```
b = BitArray(64)
b[0] = 1
b[1] = 0
```

You can also initialize with a list:

```
b = BitArray([0,1,0,1,0,1,0,1])
print(b[1])
>>> 1
```

You can also access parts of the array with slice operations:

```
sliced = b[0:4]
print(sliced[1])
>> 1
len(sliced)
>>> 4
```