Skip to main content

easier access to nested lists

Project description

easier access to nested lists

pip install nestedlistops

Example Usage

    get_nested_item(l: Iterable, i: Iterable) -> Any
        Retrieves a nested item from a given list or nested list based on the provided index sequence.
        
        Args:
            l (Iterable): The initial list or nested list.
            i (Iterable): An iterable representing the index sequence to access the desired item.
        
        Returns:
            Any: The nested item at the specified index sequence.
        
        Examples:
            >>> from nestedlistops import set_nested_item, get_nested_item
            >>> listas = [[[1, 2], [3, 4]], [[4, 5], [6, 7]], [[7, 8], [9, 9]]]
            >>> get_nested_item(l=listas, i=(0, 1, 0))
            3
    
    
    set_nested_item(l: Iterable, i: Iterable, v: Any)
        Sets the value of a nested item in a given list or nested list based on the provided index sequence.
        
        Args:
            l (Iterable): The initial list or nested list.
            i (Iterable): An iterable representing the index sequence to access the desired item.
            v (Any): The value to be assigned to the nested item.
        
        Returns:
                None (the original iterable is modified)
        
        Examples:
            >>> from nestedlistops import set_nested_item, get_nested_item
            >>> listas = [[[1, 2], [3, 4]], [[4, 5], [6, 7]], [[7, 8], [9, 9]]]
            >>> set_nested_item(l=listas, i=(0, 1, 0), v=1111)
            >>> print(listas)
            [[[1, 2], [1111, 4]], [[4, 5], [6, 7]], [[7, 8], [9, 9]]]

Project details


Release history Release notifications | RSS feed

This version

0.10

Download files

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

Source Distribution

nestedlistops-0.10.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

nestedlistops-0.10-py3-none-any.whl (4.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