Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

ValueObject is a dict-like object that exposes keys as attributes.

Project description

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']).

Project details


Release history Release notifications

This version
History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
valueobject-1.0.2.tar.gz (3.5 kB) Copy SHA256 hash SHA256 Source None Mar 6, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page