Skip to main content

Auto allocation dict and list

Project description

Overview

This is auto allocate dict and list like Perl.

import autodata

d = autodata.autodict()
d["key1"]["key2"] = "val" # => d["key1"] == {"key2": "val"}
d["key2"] += 1            # => d["key2"] == 1
d["key3"][2] = 1          # => d["key3"] == [None, None, 1]

Restriction

  • The type of dict key is only strings.

  • Dict item is not allocated by dict.get method.

  • None value is not returned by autolist[number]. Instead, an emptyitem object is returned.

Known issues

d = autodata.autodict()
a = d["key"]
a += 1  # => d == {"key" : 1}
a += 1  # => d == {"key" : 1}

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

autodata-0.12.tar.gz (2.9 kB view hashes)

Uploaded source

Built Distribution

autodata-0.12-py3-none-any.whl (3.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page