Skip to main content

bitman

What is bitman?

This is a pure python module for managing and manipulating an array of bits.

How does it work?

bitman takes advantage of python's ability to handle big integers. The array of bits is simply an integer with its bit values set as desired.

The array of bits is a class called bitman.

Attributes of bitman

  • size: It is an integer that holds the array size.
  • set(n, val): A function that sets the n-th bit to val.
  • get(n): A function that returns the truth value of the n-th bit.
  • which(val): A list of positions with a value val (0 or 1).

Installation

Please check https://pypi.org/project/bitman/ for the installable version.

You should be able to install with

pip install bitman

A quick tutorial

>>> from bitman import bitman  	# import the bitman class
>>> a = bitman(size=5,init=1)  	# 'a' is now a bitman instance with 5 bits, all initialized to 1
>>> print(a)			# printing 'a' returns the string of bits as in a binary number
11111
>>> a				# simply typing 'a' at the command line also returns the bits in the same order
11111
>>> a.get(2)			# get the truth value of the bit at position 2
True
>>> a.set(0, 0)			# set the bit at position 0 to 0.
>>> a
11110
>>> a.set(2, 0)			# set the bit at position 2 to 0.
>>> a
11010
>>> a.get(2)			# the second bit has been set to False
False
>>> a.get(3)			# the third bit is still True
True
>>> a.which(0)			# list of bits in a that are 0 
[0, 2]
>>> a.which(1)			# list of bits in a that are 1
[1, 3, 4]
>>> a.size			# how many bits are to be represented by a?
5
>>> a
11010
>>> a.size=8			# let us resize the array
>>> a
00011010

Invitation

You are welcome to improve bitman and suggest improvements.

Metadata

Release files for bitman 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitman 1.0.3
File Size Uploaded Provenance Actions
bitman-1.0.3.tar.gz 2.7 kB Without provenance Details for bitman-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bitman 1.0.3
File Interpreter ABI Platform Actions
bitman-1.0.3-py3-none-any.whl Python 3 none any Details for bitman-1.0.3-py3-none-any.whl

Total release size: 20.6 kB

Release files / bitman-1.0.3.tar.gz

Download URL bitman-1.0.3.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
59a782e455f228487044262c036a70fafab380e84f769d00823120472e862416
BLAKE2b-256 checksum
How to use checksums
edff1dca0829539c44e1476e3e8844b529d39c18e2d5205eef036732cd93c54a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Release files / bitman-1.0.3-py3-none-any.whl

Download URL bitman-1.0.3-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b29663783ced7a0906e97229c42f58a2625114c6682aad9e56825bc57c9a3ae6
BLAKE2b-256 checksum
How to use checksums
88f069d45e9f26629b825132e457779d7f45216e266b04ce951dbd1b7d230444
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

Security for bitman 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page