Skip to main content

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:

  1. 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
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deep_isin-1.0.1.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

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

deep_isin-1.0.1-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

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

Hashes for deep_isin-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ef6348f07659160da8841e92ae0e7cf45776e2fb2d00495652ae4b000111fcfc
MD5 19ecc624f1ca519f4cccbb7ff8f8a712
BLAKE2b-256 6b6523a6e13048eeb138f65c257a2691992787d320a575d51967f137a79e6c03

See more details on using hashes here.

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

Hashes for deep_isin-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 29fa0b23f3022072e6e4eecc9c4fa60ba58fc2fb33888d3280da8690d06eaa0b
MD5 70231127ec359e101296cf7196242583
BLAKE2b-256 13cf69a2d7e0def41ecbdcff4b38c0d009cf760bac688a5079848667eb118bb9

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