A simple struct-like object for Python. Compatible with Python 2.6+, 3.x, pypy and pypy3.
Installation
pip install basicstruct
Usage
To create your own struct, inherit from BasicStruct and define the field with the __slots__ class member. BasicStruct are efficient objects that are automatically comparable, hashable, picklable, printable and reprable.
from basicstruct import BasicStruct
- class Point(BasicStruct):
__slots__ = (‘x’, ‘y’)
p1 = Point(2, 3) p2 = Point(1, y=6) p3 = Point(x=0, y=0)
print(p1) # prints: Point(x=2, y=3)
Release files for basicstruct 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| basicstruct-1.0.2.tar.gz | 3.0 kB | Details |
Release files / basicstruct-1.0.2.tar.gz
| Download URL | basicstruct-1.0.2.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
392abfe121c34842c28823188d6eb42d2de174fcb3039271fc8787f55dcecf95
|
|
BLAKE2b-256 checksum How to use checksums |
640f7587f157969b68b685f71d01f9865d7f225cddc7149eddc4a2ab66dc00a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |