# ValueObject [![Build Status](https://app.travis-ci.com/dwt/valueobject.svg?branch=master&status=created)](https://app.travis-ci.com/github/dwt/valueobject)
License: ISC - See LICENSE file
`ValueObject` is a `dict`-like object that exposes keys as attributes.
You can use it like a regular dictionary (in fact, it is a subclass
and does not override its `__init__`). You can use attribute or item
access to get or set values.
>>> from valueobject import ValueObject
>>> vo = ValueObject(key=1)
>>> vo['key']
1
>>> vo.key
1
>>> vo['key'] += 1
>>> vo.key += 1
>>> vo['key']
3
>>> vo.key
3
## Usability notes:
- If you need to access a key that is not a valid Python identifier
(for example, it includes spaces), use regular dict access.
- All regular `object`, `dict` and `ValueObject` methods will be
returned on attribute access. A key such as `copy` needs to be
accessed via item access syntax (e.g. `valueobject['copy']`).
## Changelog
- 1.0.3: Minor build fixes, to make the setup.py file python3 safe. While the rest of the library was python3 safe all along, that file was not… 😬
Raw data
{
"_id": null,
"home_page": "https://github.com/rbu/valueobject",
"name": "valueobject",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Felix Schwarz, Martin H\u00e4cker, Robert Buchholz",
"author_email": "rbu@goodpoint.de, spamfaenger@gmx.de",
"download_url": "https://files.pythonhosted.org/packages/06/a0/98994e07f18097d10eeb03c156bb79e8568dce2fc434a08037856ab1b904/valueobject-1.0.3.tar.gz",
"platform": null,
"description": "# ValueObject [![Build Status](https://app.travis-ci.com/dwt/valueobject.svg?branch=master&status=created)](https://app.travis-ci.com/github/dwt/valueobject)\n\nLicense: ISC - See LICENSE file\n\n`ValueObject` is a `dict`-like object that exposes keys as attributes.\nYou can use it like a regular dictionary (in fact, it is a subclass\nand does not override its `__init__`). You can use attribute or item\naccess to get or set values.\n\n >>> from valueobject import ValueObject\n >>> vo = ValueObject(key=1)\n >>> vo['key']\n 1\n >>> vo.key\n 1\n >>> vo['key'] += 1\n >>> vo.key += 1\n >>> vo['key']\n 3\n >>> vo.key\n 3\n\n## Usability notes:\n\n - If you need to access a key that is not a valid Python identifier\n (for example, it includes spaces), use regular dict access.\n - All regular `object`, `dict` and `ValueObject` methods will be\n returned on attribute access. A key such as `copy` needs to be\n accessed via item access syntax (e.g. `valueobject['copy']`).\n\n## Changelog\n\n- 1.0.3: Minor build fixes, to make the setup.py file python3 safe. While the rest of the library was python3 safe all along, that file was not\u2026 \ud83d\ude2c\n",
"bugtrack_url": null,
"license": "ISC",
"summary": "ValueObject is a dict-like object that exposes keys as attributes.",
"version": "1.0.3",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "867fdc63aa646691da33e435c2e9207b",
"sha256": "a1ec4a925e24afc6850008ef13d953c8dbf0595b6962e597657e98152aff8bc6"
},
"downloads": -1,
"filename": "valueobject-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "867fdc63aa646691da33e435c2e9207b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3833,
"upload_time": "2022-12-13T09:02:40",
"upload_time_iso_8601": "2022-12-13T09:02:40.650237Z",
"url": "https://files.pythonhosted.org/packages/1a/67/3db084eaf286b3f7e2d3b34872aad305c72b987ffa18cb1a03e431855d2d/valueobject-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "a9aee73618c648b3db4c93c7c9fe26c3",
"sha256": "0db56028ee8da2349f888cfed844053b0c835d2675a76f1beb41791afd81cad0"
},
"downloads": -1,
"filename": "valueobject-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "a9aee73618c648b3db4c93c7c9fe26c3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3404,
"upload_time": "2022-12-13T09:02:43",
"upload_time_iso_8601": "2022-12-13T09:02:43.338507Z",
"url": "https://files.pythonhosted.org/packages/06/a0/98994e07f18097d10eeb03c156bb79e8568dce2fc434a08037856ab1b904/valueobject-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-13 09:02:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "rbu",
"github_project": "valueobject",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "valueobject"
}