Skip to main content

Slice dictionaries just like tuples and lists

Project description

cleverslice

cleverslice is a Python library that enhances dictionary usage by introducing slicing capabilities similar to tuples and lists, without compromising the dictionary's inherent functionalities. This makes it easier to work with dictionary subsets, improving the flexibility and efficiency of dictionary operations in Python applications.

Features

  • Slicing: Perform slicing operations on dictionaries similar to tuples and lists.
  • Compatibility: Fully compatible with standard dictionary operations.
  • Ease of Use: Intuitive syntax that fits seamlessly into existing Python codebases.

Installation

To install cleverslice, simply use pip:

pip install cleverslice

Usage

Here is a quick example to get you started with cleverslice:

from cleverslice import sdict

my_dict = sdict({'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5})

# First 3 items as a dict
f3d = my_dict[:3]

# Last 2 items as a dict
l2d = my_dict[-2:]

# Middle items as a dict, from index 1 to 3
md = my_dict[1:3]

# Every other item as a dict
e2d = my_dict[::2]

# 4th item's value
v4 = my_dict[3]

# 4th item as a dict
d4 = my_dict[3:4]

In this example, we first create a cleverslice object from a standard dictionary. We then perform a slicing operation to obtain a subset of the dictionary. The cleverslice object still supports all standard dictionary operations.

Documentation

For more detailed documentation, please visit our official documentation.

Contributing

Contributions to cleverslice are welcome! If you have ideas for improvement or have found a bug, feel free to open an issue or submit a pull request. Please see our contributing guide for more details.

Acknowledgments

A special thank you to Miss Jyu for the continuous support and encouragement throughout the development of this project. Your insight and contributions have been invaluable.

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

cleverslice-1.0.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cleverslice-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file cleverslice-1.0.0.tar.gz.

File metadata

  • Download URL: cleverslice-1.0.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for cleverslice-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8e18e11577d9ba1974bfe377abb1af37361315ab2a9b37c8803eb528dd3e3f09
MD5 a400279073163e8a566b0af098eb016d
BLAKE2b-256 3f5d91f5bd13d6023c4517ccc8b78981b425d74b0cd199ecd6bf60b27268d80e

See more details on using hashes here.

File details

Details for the file cleverslice-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cleverslice-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for cleverslice-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25d73216c1cbcbcba4f93366cfdb73230d745a485e1ee06499e9d6b8b2a5e866
MD5 315797f2b30eece91748f5e10ed980e6
BLAKE2b-256 c040595d4917fd62d619c508e175c14312a37f670858c950caa3a62d13a568f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page