How to use the memoization.memoization_py2._HashedList function in memoization

To help you get started, we’ve selected a few memoization examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lonelyenvoy / python-memoization / memoization / memoization_py2.py View on Github external
def __init__(self, tup, hash_value):
        super(_HashedList, self).__init__(tup)
        self.hash_value = hash_value
github lonelyenvoy / python-memoization / memoization / memoization_py2.py View on Github external
def _make_key(args, kwargs, kwargs_mark=(object(),)):
    """
    Make a cache key
    """
    key = args
    if kwargs:
        key += kwargs_mark
        for item in kwargs.items():
            key += item
    try:
        hash_value = hash(key)
    except TypeError:  # process unhashable types
        return str(key)
    else:
        return _HashedList(key, hash_value)