namedtuple, classes and dictionaries are no longer the only options to represent a key/value mapping where all they keys are known upfront: Records may be a better alternative and they’re now available in Python via PyRecord.
This implementation is meant to be a highly improved version of namedtuple, but not yet a replacement. Features include:
- Amazing inheritance support (inspired by tagged records in the Ada programming language).
- Ability to set optional fields with default values.
- Fully documented and with 100% of unit test coverage.
- Runs on Python v2.7 to v3.x and PyPy v2.
Even though its latest version is a release candidate, the library is absolutely stable and has been in production systems for months.