Skip to main content

Minimal Python library for working with little-endian list representation of bit strings.

Project description

Minimal pure Python library for working with little-endian list representation of bit strings.

Purpose

This library allows programmers to work with a little-endian representation of bit strings within Python. Its purpose is primarily pedagogical, although it can be useful under other circumstances.

Package Installation and Usage

The package is available on PyPI:

python -m pip install bitlist

The library can be imported in the usual way:

import bitlist
from bitlist import bitlist

Testing

The library comes with a number of tests:

nosetests

Examples

An example of usage (a bitwise addition function) is provided below:

from bitlist import bitlist
def add(x, y):
    k = len(x)
    l = len(y)
    r = bitlist(0)
    c = 0
    for i in range(0, max(k,l)): # Upper bound is not inclusive.
        r[i] = (x[i] ^ y[i]) ^ c
        c = (x[i] & y[i]) | (x[i] & c) | (y[i] & c)
    r[max(k,l)] = c
    return r

Project details


Release history Release notifications

This version
History Node

0.1.0.1

History Node

0.1.0.0

History Node

0.0.9.0

History Node

0.0.8.0

History Node

0.0.7.0

History Node

0.0.6.0

History Node

0.0.5.0

History Node

0.0.4.0

History Node

0.0.3.0

History Node

0.0.2.0

History Node

0.0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
bitlist-0.1.0.1.tar.gz (2.2 kB) Copy SHA256 hash SHA256 Source None Sep 12, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page