Welcome to Esu Struct!
Enjoy the flexibility of structs with esu!
You can create types on the fly with previously declared fields and methods by using esu struct.
The created type additionally contains methods for equation, hashing and string representation.
Install
pip install esu
Usage
Struct
from esu import Struct, OpenStruct
Customer = Struct(
'Customer',
'name', 'age',
methods={
'greeting': lambda self: "Hello {}".format(self.__dict__['name'])
})
dave = Customer()
dave.name = 'Dave'
dave.age = 25
dave.greeting() # => Hello Dave
anna = Customer('Anna', 28)
anna.greeting() # => Hello Anna
OpenStruct
bob = OpenStruct()
bob.name = Bob
bob.age = 54
print(bob) # => [name=Bob, age=54]
su = OpenStruct({'name': 'Su', 'gender': 'female'})
su.employed = True
print(su) # => [name=Su, gender=female, employed=True]
Documentation
For further information, read the documentation that can be found: https://esu.readthedocs.io
Contribution
- Fork it!
- Make your changes!
- Send a PR!
Metadata
Release files for esu 3.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 | Provenance | |
|---|---|---|---|---|
| esu-3.0.2.tar.gz | 3.4 kB | Without provenance | Details |
Release files / esu-3.0.2.tar.gz
| Download URL | esu-3.0.2.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e819ac6cd50e1d626d22d2f9b895a6c38d2b5b7b5e4710fe1810624dd6804dcb
|
|
BLAKE2b-256 checksum How to use checksums |
9173a4f4c76f8ea7416d504d3303500e9f16802b90c83fd4afc26c146bf51206
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for esu 3.0.2
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.