(dictionary, index=None)
Get a unique storage point within a class method.

    Parameters
    ----------
    dictionary : dict
        A dictionary used for storage.
    index : hashable
        An index under which to store the element. Needs to be hashable.
        This is useful for functions which might be accessed with multiple
        different arguments.

    Returns
    -------
    storage : OrderedDict
        The storage object. Is None if no storage exists. Otherwise it
        returns the OrderedDict that was previously put in the storage.
Get a unique storage point within a class method.
Get a unique storage point within a class method .
def get_storage(dictionary, index=None):
    """Get a unique storage point within a class method.

    Parameters
    ----------
    dictionary : dict
        A dictionary used for storage.
    index : hashable
        An index under which to store the element. Needs to be hashable.
        This is useful for functions which might be accessed with multiple
        different arguments.

    Returns
    -------
    storage : OrderedDict
        The storage object. Is None if no storage exists. Otherwise it
        returns the OrderedDict that was previously put in the storage.
    """
    # Use function name as storage name
    frame = inspect.currentframe()
    storage_name = inspect.getframeinfo(frame.f_back).function

    storage = dictionary.get(storage_name)

    if index is None:
        return storage
    elif storage is not None:
        # Return directly the indexed object
        try:
            return storage[index]
        except KeyError:
            pass
def get_storage ( dictionary , index = None ) : # Use function name as storage name frame = inspect . currentframe ( ) storage_name = inspect . getframeinfo ( frame . f_back ) . function storage = dictionary . get ( storage_name ) if index is None : return storage elif storage is not None : # Return directly the indexed object try : return storage [ index ] except KeyError : pass