Skip to main content

EZDict

Making Python's dict easier to work with by adding object notation and grouping.

  1. Allows keys to be accessed as attributes, so ezdict.attr can be used instead of ezdict["attr"]. Note, this only works with string keys. Additionally, any keys that overlap with method names will be shadowed, so to access the key keys, use ezdict["keys"] instead of ezdict.keys.
  2. Provide two methods, incrementer and appender, to support the common operations of counting the occurrences of a key and grouping values by a key, respectively.

Installation

pip install ezdict

Import

from ezdict import EZDict

Usage

Accessing Keys as Attributes

from ezdict import EZDict

ez = EZDict({
    "id": "5e2797c05aa0585816ce8b8c",
    "title": "EZDict",
    "description": "Super cool Python package",
    "author": "Jacob Morris (BlendingJake)",
    "meta": {
        "created": "March 27th, 2020"
    }
})

print(ez.title)  # >>> "EZDict"
print(ez.meta.created)  # >>> "March 27th, 2020"

Grouping/Counting Like a Pro

from ezdict import EZDict

# tried of this?
iterable = [ ... ]
grouped = {}
for item in iterable:
    if item["key"] in grouped:
        grouped[item["key"]] += 1
        # OR grouped[item["key"]].append(item)
    else:
        grouped[item["key"]] = 1
        # OR grouped[item["key"]] = [item]

# do this instead
iterable = [ ... ]
grouped = EZDict()
for item in iterable:
    grouped.incrementer(item["key"])
    # OR grouped.appender(item["key"], item)

incrementer(key, increment=1)

Increment key by increment if the key has already been seen. Otherwise, set the key equal to increment.

appender(key, value)

Append value to the list of values associated with key if that key was already been seen. Otherwise, set the key equal to [value].

Metadata

Release files for ezdict 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ezdict 1.0.0
File Size Uploaded Provenance Actions
ezdict-1.0.0.tar.gz 2.9 kB Without provenance Details for ezdict-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ezdict 1.0.0
File Interpreter ABI Platform Actions
ezdict-1.0.0-py3-none-any.whl Python 3 none any Details for ezdict-1.0.0-py3-none-any.whl

Total release size: 18.6 kB

Release files / ezdict-1.0.0.tar.gz

Download URL ezdict-1.0.0.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
98f5574c2b82108d9bb8852724d6d4188e2670e0857628f523b6c267480b3e1d
BLAKE2b-256 checksum
How to use checksums
d686aef76cb5409fc47324b5fc9cbab748a3b00b3abba4af9d5c932d27738698
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

Release files / ezdict-1.0.0-py3-none-any.whl

Download URL ezdict-1.0.0-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34e92c3cd28143251ab767d5a02b6cd1fb2d2133b7effa603a0941c705367c09
BLAKE2b-256 checksum
How to use checksums
35777efaa4fb3d488c164e14ed8f9ba0bb7a3cc00f4d823d141a9d1d59f106aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

Security for ezdict 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page