Sometimes, you want to use a mapping object like a regular object.
zc.mappingobject provides a wrapper for a mapping objects that provides both attribute and item access.
>>> import zc.mappingobject >>> mapping = dict(a=1) >>> ob = zc.mappingobject.mappingobject(mapping)
>>> ob.a 1 >>> ob.a = 2 >>> ob.a 2 >>> mapping {'a': 2}>>> list(ob) ['a']
>>> len(ob) 1
>>> ob['a'] = 3 >>> ob.a 3 >>> mapping {'a': 3}>>> del ob.a >>> mapping {} >>> ob.a Traceback (most recent call last): ... AttributeError: a>>> ob.b = 1 >>> mapping {'b': 1}>>> del ob['b'] >>> mapping {}
Release files for zc.mappingobject 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zc.mappingobject-1.0.0.tar.gz | 2.2 kB | Details |
Release files / zc.mappingobject-1.0.0.tar.gz
| Download URL | zc.mappingobject-1.0.0.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
134345e1a783da001fc2e73a356bd0a2228ff93aead31d87352d1acf15240913
|
|
BLAKE2b-256 checksum How to use checksums |
382d0e6af6048ac99d8e1871a369698097f4125145a3a75ee39d5003c650d73d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |