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

pip3 -m install objdict

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.0.4.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: objdict_hephhay-0.0.4.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.0.4.tar.gz
Algorithm Hash digest
SHA256 590990b05446ef993a4e3ac21b1334d31de1758389c0e861d05ddcf7d12c2d87
MD5 bf6dea89b1525a6a51d8962078608a22
BLAKE2b-256 ca52648e9bc120c25f7b21e8601d459bac80556008acbe2fe5fed6897d7f74b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for objdict_hephhay-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ca0bd0751cbc4b1cd6b262649b824559370f2ea3b6fa5f59b98a18f4c2347db4
MD5 cb6210dda1c04df65d180fd8b7923b8b
BLAKE2b-256 c3c52feb0b9543e614e789a230c33b9a06d5c13b4ddaff17bdcd536970f394db

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