SickDict
An IDE friendly (auto-completion) python dictionary with dot-accessible attributes.
Why?
- The pythonic way to access the dictionary
d['key']is prone to errors and honestly, pretty ugly. - The case becomes worse when the dictionary is a nested one
d['key1]['key2']. Now obviously d.key1.key2.key3 is much better. - Default python dictionary does not support auto-completion in almost all the IDE's, but SickDict will.
How to use it?
- Install the package:
pip install sick-dict
- Import the package:
from sick_dict import SickDict
Features
- Create a dictionary without defining it keys beforehand
sd = SickDict()
sd.hello = "world"
- Pass a dictionary and all the keys in dictionary will become properties
d = {'hello': 'world'}
sd = SickDict(d)
print(sd.hello) # world
- Pass keyword arguments and all the arguments will become properties
sd = SickDict(hello="world", this_is="awesome")
print(sd.hello) # world
print(sd.this_is) # awesome
- Pass both dictionary and keyword arguments
d = {'hello': 'world'}
sd = SickDict(d, this_is="awesome")
print(sd.hello) # world
print(sd.this_is) # awesome
- Pass a nested dictionary with a list
foo = {
"bar" : {
"baz" : [{"boo" : "hoo"}, {"baba" : "loo"}]
}
}
sd = SickDict(foo)
print(sd.bar.baz[0].boo) # hoo
- Use
delkeyword to remove a key
sd = SickDict(hello="world", this_is="awesome")
del sd.hello
print(sd.hello) # Key
- Use
+operator to combine two instances of SickDict
sd1 = SickDict(hello="world")
print(sd1) # SickDict({'hello': 'world'})
sd2 = SickDict(this_is="awesome")
print(sd2) # SickDict({'this_is': 'awesome'})
print(sd1 + sd2) # SickDict({'hello': 'world', 'this_is': 'awesome'})
- Use other dictionary functions like
get(),update()etc.
sd = SickDict(hello="world")
print(sd.get('hello')) # world
sd.update({'who_are_you': 'developer'}, this_is="awesome")
print(sd) # SickDict({'hello': 'world', 'who_are_you': 'developer', 'this_is': 'awesome'})
Metadata
Release files for sick-dict 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sick-dict-0.2.tar.gz | 3.6 kB | Without provenance | Details for sick-dict-0.2.tar.gz |
Release files / sick-dict-0.2.tar.gz
| Download URL | sick-dict-0.2.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6811511fe270846a065acb22100d7845e21a530785a19b87adf46ffe408c5c72
|
|
BLAKE2b-256 checksum How to use checksums |
3b24ed34c0834ec2c4fa636d619a91f8dce54a648af292a912fa815b2515797a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.3
|
Security for sick-dict 0.2
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.