Skip to main content
https://travis-ci.org/Nurdok/basicstruct.svg https://coveralls.io/repos/Nurdok/basicstruct/badge.svg?branch=master&service=github

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)

Download files

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

Source Distribution

basicstruct-1.0.2.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file basicstruct-1.0.2.tar.gz.

File metadata

  • Download URL: basicstruct-1.0.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for basicstruct-1.0.2.tar.gz
Algorithm Hash digest
SHA256 392abfe121c34842c28823188d6eb42d2de174fcb3039271fc8787f55dcecf95
MD5 16ba1a209dbd8bb3e91321d8e0c460f8
BLAKE2b-256 640f7587f157969b68b685f71d01f9865d7f225cddc7149eddc4a2ab66dc00a1

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.3

1 file

This release

1.0.2 This release

1 file

1.0.1

1 file

1.0.0

1 file

0.0.1

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page