(f)
return wraped
Return a function that will be called only once, and it's result cached.
Return a function that will be called only once, and it's result cached.
Return a function that will be called only once and it s result cached .
def once(f):
    """
    Return a function that will be called only once, and it's result cached.
    """
    cached = None

    @wraps(f)
    def wraped():
        nonlocal cached
        if cached is None:
            cached = Some(f())
        return cached.val
    return wraped
def once ( f ) : cached = None @ wraps ( f ) def wraped ( ) : nonlocal cached if cached is None : cached = Some ( f ( ) ) return cached . val return wraped