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.1.tar.gz (4.2 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.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cleverslice-1.0.1.tar.gz
  • Upload date:
  • Size: 4.2 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.1.tar.gz
Algorithm Hash digest
SHA256 8f130af12dda6e1d9f31dded4d42a3badd185b2b1410706d7e7be01fc60af3ae
MD5 ed5d80cddc5ed51f4fccac813e09fa88
BLAKE2b-256 bc2fe3b57e790c9d0621d825a7b2afb0ce3f5b66e2c10ff4c2300d7920537bea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cleverslice-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d953a55f125a6ec51a0b0dbd6858323d1acef4bc5f69829e6a710cb73bf2f30c
MD5 b14aba591ae83ebc391b449aadab0736
BLAKE2b-256 8a8a2568902d2b235394fa4c1d5c34aa27b4068f33d22e6ce2341e4b1bdd05b7

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