Python value object implementation
Project description
About
Abstract base class for python value objects.
Usage
Extend and implement the is_valid method.
class Weight(ValueObject):
def is_valid(self, value: int) -> bool:
return isinstance(value, int) and value >= 0
Equality example:
o = Weight(10)
p = Weight(11)
q = Weight(11)
print('o ', o)
print('p ', p)
print('q ', q)
print('o == p ', o == p)
print('o == q ', o == q)
print('p == q ', p == q)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pythonvalueobject-1.0.0.tar.gz
.
File metadata
- Download URL: pythonvalueobject-1.0.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c081324f2850e2cb4a0c26a41fe55e39a145b8b955237d982f29727c964b201 |
|
MD5 | d1a859028664bf462014320a3d8ba486 |
|
BLAKE2b-256 | 31a24eebf14d5744b7d5cf0d59a9ffcff00628dcd81f71e3aa17c85b55a9a167 |