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

obj__depth : int depth of conversion to ObjDict

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: objdict_hephhay-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 cac11779b54d77fe8e207c96dc6604c820a429372629503f6e0b6f0a61ffa64d
MD5 0432b6c2da3ae8dc93df7a1dc1c70db8
BLAKE2b-256 913b126d57f3e8b4cc9fc332f2c0d74a33feaf9a32e2986d46dc60adf7cf578f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for objdict_hephhay-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba60960e4c56df1cecdc8d48b9dbaecd0d06ce9416f6a1cc8eae8cd6abb1d519
MD5 966bfac9c34d0098c3f9f98adff1b1ac
BLAKE2b-256 148737f0df3238b56d8f8c52cc8faf9ac27646ae0f2255ce680616c472d93a57

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