[Python] What is this lazy execution approach (using lambda) also known as?

Discussão em 'Python' iniciado por Stack, Maio 30, 2025.

  1. Stack

    Stack Membro Participativo

    import time

    start_time = time.time() # get current time
    request_time = lambda: "%.5fs" % (time.time() - start_time)

    time.sleep(10)

    result = request_time()


    result will be the difference of the present value of time instead of the lambda creation time.

    What is this lazy concept also known as? Is it the same as late binding/closure concept in Python, as explained in Common Gotchas – Late Binding Closures?

    Continue reading...

Compartilhe esta Página