Skip to main content

An example package. Replace this with a proper project description. Generated with https://github.com/ionelmc/cookiecutter-pylibrary

Project description

Travis-CI Build Status AppVeyor Build Status Coverage Status PYPI Package PYPI Package

Container class boilerplate killer.

Features:

  • Human-readable __repr__

  • Complete set of comparison methods

  • Keyword and positional argument support. Works like a normal class - you can override just about anything in the subclass (eg: a custom __init__). In contrast, hynek/characteristic forces different call schematics and calls your __init__ with different arguments.

Installation

pip install fields

Usage

>>> from fields import Fields
>>>
>>> class Pair(Fields.a.b):
...     pass
...
>>> p = Pair(1, 2)
>>> p.a
1
>>> p.b
2
>>> class Node(Fields.value.left(None).right(None)):
...     pass
...
>>> p = Node(1, left=Node(2), right=Node(3, left=Node(4)))
>>> p
<Node(left=<Node(left=None, right=None, value=2)>, right=<Node(left=<Node(left=None, right=None, value=4)>, right=None, value=3)>, value=1)>

Documentation

https://python-fields.readthedocs.org/

Development

To run the all tests run:

tox

Changelog

0.1.0 (2014-06-08)

  • First release on PyPI.

Project details


Download files

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

Source Distribution

fields-0.1.0.tar.gz (12.5 kB view hashes)

Uploaded Source

Built Distribution

fields-0.1.0-py2.py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page