Skip to main content

Little bit better than dict

Project description

Description

Like dict, but a little bit better

install

  pip install dictones

import

from dictones import DictOnes

Usage

1. Added constructor

  filled_dict = DictOnes('first_key, second_key', 'to first key', 'to second key')
  print(filled_dict.first_key)
  print(filled_dict.second_key)

Output

'to first key'
'to second_key'

2. Constructor without filling

  filled_dict = DictOnes('first_key, second_key')
  print(filled_dict.first_key)
  print(filled_dict.second_key)
  print(filled_dict.key)

Output

None
None
...raise KeyError(attrname)
KeyError: 'key'

3. Deleting

filled_dict = DictOnes('first_key, second_key')
print(filled_dict.first_key)
print(filled_dict.second_key)
print('second_key' in filled_dict)
del filled_dict.second_key
print('second_key' in filled_dict)

Output

None
None
True
False

Otherwise it is the same dict

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

dictones-0.1.1.tar.gz (24.8 kB view hashes)

Uploaded Source

Built Distribution

dictones-0.1.1-py3-none-any.whl (35.3 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