Skip to main content

Enjoy the flexibility of structs with esu!

Project description

Welcome to Esu Struct!

Build Status Documentation Status PyPI PyPI - Python Version PyPI - License

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.


pip install esu



from esu import Struct, OpenStruct

Customer = Struct(
            'name', 'age', 
                'greeting': lambda self: "Hello {}".format(self.__dict__['name'])

dave = Customer() = 'Dave'
dave.age = 25
dave.greeting() # => Hello Dave 

anna = Customer('Anna', 28)
anna.greeting() # => Hello Anna


bob = OpenStruct() = 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]


For further information, read the documentation that can be found:


  1. Fork it!
  2. Make your changes!
  3. Send a PR!

Project details

Download files

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

Files for esu, version 3.0.2
Filename, size File type Python version Upload date Hashes
Filename, size esu-3.0.2.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page