Skip to main content

DDD Value Objects implementation

Project description

Info:

DDD Value Objects implementation.

Author:

Paweł Zadrożny @pawelzny <pawel.zny@gmail.com>

Features

  • Value object can’t be changed once created

  • Two objects with the same values are considered equal

  • Access to values after dot: value.my_value

  • Access to values like dict: value[‘my_value’]

Installation

pip install vo

Package: https://pypi.python.org/pypi/vo

Example

from vo import Value

value1 = Value(test=True, some_text="I am some text string")
value2 = Value(some_text="I am some text string", test=True)
value3 = Value(purpose_of_life=42)

assert(value1 == value1)  # True
assert(value1 == value2)  # True
assert(value1 == value3)  # False

print(value3.purpose_of_life)  # 42
print(value3['purpose_of_life'])  # 42

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

vo-0.2.0.tar.gz (16.3 kB view hashes)

Uploaded Source

Built Distribution

vo-0.2.0-py3-none-any.whl (5.0 kB view hashes)

Uploaded 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