## 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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/virtualitems",
"name": "pythonvalueobject",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "value,object",
"author": "github@virtualitems",
"author_email": "virtualitemsuniverse@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/31/a2/4eebf14d5744b7d5cf0d59a9ffcff00628dcd81f71e3aa17c85b55a9a167/pythonvalueobject-1.0.0.tar.gz",
"platform": null,
"description": "## About\r\n\r\nAbstract base class for python value objects.\r\n\r\n## Usage\r\n\r\nExtend and implement the _is_valid_ method.\r\n\r\n```\r\nclass Weight(ValueObject):\r\n def is_valid(self, value: int) -> bool:\r\n return isinstance(value, int) and value >= 0\r\n```\r\n\r\nEquality example:\r\n\r\n```\r\no = Weight(10)\r\np = Weight(11)\r\nq = Weight(11)\r\n\r\nprint('o ', o)\r\nprint('p ', p)\r\nprint('q ', q)\r\nprint('o == p ', o == p)\r\nprint('o == q ', o == q)\r\nprint('p == q ', p == q)\r\n```\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python value object implementation",
"version": "1.0.0",
"split_keywords": [
"value",
"object"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "31a24eebf14d5744b7d5cf0d59a9ffcff00628dcd81f71e3aa17c85b55a9a167",
"md5": "d1a859028664bf462014320a3d8ba486",
"sha256": "8c081324f2850e2cb4a0c26a41fe55e39a145b8b955237d982f29727c964b201"
},
"downloads": -1,
"filename": "pythonvalueobject-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "d1a859028664bf462014320a3d8ba486",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2753,
"upload_time": "2023-03-11T02:10:01",
"upload_time_iso_8601": "2023-03-11T02:10:01.197757Z",
"url": "https://files.pythonhosted.org/packages/31/a2/4eebf14d5744b7d5cf0d59a9ffcff00628dcd81f71e3aa17c85b55a9a167/pythonvalueobject-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-11 02:10:01",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "pythonvalueobject"
}