Skip to main content

Python Dict with classlike access to its contents (dot.notation,creates missing keys on the fly,...)

Project description

Clict

Python Dict with classlike access to its contents (dot.notation,creates missing keys on the fly,...)

Dict VS Clict:

Creation & Initialisation:

Dict only one step:

x={'y': 'z'}

or

x=dict(y=z)

Clict you need to call the class first:

a=Clict()

Then these work:

a.b='c' 				
	# or
a['b']= 'c'
# you can call the class and populate when doing so,
Clict(a=1, b=2) 

note: this works recursively if the key doesnt exist for that Clict , its created as a new Clict so this works for initializing deeply nested 'dicts' :

a=Clict()
a.b.c.d.e.f.g.h.i.j=''

Usage:

you can both assign and recall values by the dot notation as with the conventional dict square brackets, and they can be mixed in a single lookup, However where you can create a dict with

a={}

Clict unfortunatly cannot be a drop in replacement for dicts as the only way to create one is by calling the Class on it. Then you can assign values to keys in it.

a=Clict(
)

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

clict-0.5.4.tar.gz (17.1 kB view hashes)

Uploaded Source

Built Distribution

Clict-0.5.4-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

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