Skip to main content

An object wrapper for dict that allows for using object type notation with dictionaries.

Project description

OBJDICT

An object wrapper for dict that allows for using object type notation with dictionaries.

Installation

pip install objdict-hephhay

Description

An object style implementation for dict that allows for using object type dot(.) notation with dictionaries.

All dict operations such as .pop(), .items(), .contains() etc' will also work with ObjDict

Example

from objdict_hephhay import ObjDict
object = ObjDict(<dict>)

object.<dict key>

usage

Parameters

dict : int Dictionary to convert

depth : int Second number to add = 0 if you want only a single level of conversion

Returns

objdict.ObjDict An instance of ObjDict

Examples

>>>  obj = ObjDict(foo = 1, bar = 2)
<ObjDict : {"foo" : 1, "bar" : 2}>
>>> dictionary = {"foo" : 1, "bar" : 2}
>>> obj1 = ObjDict(dictionary)
>>> obj1.foo
1
>>> dictionary_2 = {"foo" : 1, "bar" : 2, "baz" : {"alice" : 3, "bob" : {"steph" : 5}}}
>>> obj2 = ObjDict(dictionary_2, depth = 1)
>>> obj2.bar
2
>>> obj2.baz
<ObjDict : {'alice': 3, 'bob': {'steph': 5}}>

Project details


Download files

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

Source Distribution

objdict_hephhay-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

objdict_hephhay-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file objdict_hephhay-0.1.0.tar.gz.

File metadata

  • Download URL: objdict_hephhay-0.1.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for objdict_hephhay-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ca1dd9e8b1f3383054461d514dc3d57c232e81960292a42957ed7744d58cc74b
MD5 fca0e1189657e27e29d2186ab00faef3
BLAKE2b-256 2b4385da084030c6ab0e861a00df2215fe79af72a584c2c724ecd94e6522a49b

See more details on using hashes here.

File details

Details for the file objdict_hephhay-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for objdict_hephhay-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23aa0e592ed5b0ee139b264c66a7810be852c94a4ed3986bd3b03855e28072a0
MD5 7f14e42c8475cacd3c3ef31e7b95ccd8
BLAKE2b-256 020e640a550b3a35c49d514dadb84c9b5b454def414014f1c175629e48fc2c5b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page