(method)
return new_method
Decorator to cache the result of a method (without arguments) using a
    weak reference to its object
Decorator to cache the result of a method (without arguments) using a
    weak reference to its object
Decorator to cache the result of a method ( without arguments ) using a weak reference to its object
def memoizemethod_noargs(method):
    """Decorator to cache the result of a method (without arguments) using a
    weak reference to its object
    """
    cache = weakref.WeakKeyDictionary()

    @wraps(method)
    def new_method(self, *args, **kwargs):
        if self not in cache:
            cache[self] = method(self, *args, **kwargs)
        return cache[self]

    return new_method
def memoizemethod_noargs ( method ) : cache = weakref . WeakKeyDictionary ( ) @ wraps ( method ) def new_method ( self , * args , * * kwargs ) : if self not in cache : cache [ self ] = method ( self , * args , * * kwargs ) return cache [ self ] return new_method