this checks key or value in dict(or list)
Project description
deep_isin
deep_isin is a Python package that allows you to safely check whether a specific value exists in nested data structures such as dictionaries, lists, tuples, and sets. It also safely handles circular references to prevent infinite recursion.
Installation:
pip install deep_isin
Usage:
- Import the entire module:
import deep_isin
data = {123: [1, 2, {456: [7, 8]}], "abc": (9, 10)}
print(deep_isin.isin(data, 7)) # True
print(deep_isin.isin(data, 99)) # False
- Import the function directly:
from deep_isin import isin
data = {123: [1, 2, {456: [7, 8]}], "abc": (9, 10)}
print(isin(data, 456)) # True
print(isin(data, 0)) # False
Features:
- Works with nested dictionaries, lists, tuples, and sets.
- Checks both keys and values in dictionaries.
- Handles circular references safely to avoid infinite recursion.
- Can handle any mix of nested Python data structures.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deep_isin-1.0.1.tar.gz.
File metadata
- Download URL: deep_isin-1.0.1.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef6348f07659160da8841e92ae0e7cf45776e2fb2d00495652ae4b000111fcfc
|
|
| MD5 |
19ecc624f1ca519f4cccbb7ff8f8a712
|
|
| BLAKE2b-256 |
6b6523a6e13048eeb138f65c257a2691992787d320a575d51967f137a79e6c03
|
File details
Details for the file deep_isin-1.0.1-py3-none-any.whl.
File metadata
- Download URL: deep_isin-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29fa0b23f3022072e6e4eecc9c4fa60ba58fc2fb33888d3280da8690d06eaa0b
|
|
| MD5 |
70231127ec359e101296cf7196242583
|
|
| BLAKE2b-256 |
13cf69a2d7e0def41ecbdcff4b38c0d009cf760bac688a5079848667eb118bb9
|