On Sat, Oct 23, 2021 at 11:53 PM Steven D'Aprano <steve@pearwood.info> wrote:
If we had thunks, that would give us late binding for free:

    def bisect(a, x, lo=0, hi=thunk len(a), *, key=None)

I'm unclear on exactly what the semantics of a thunk would be, but I don't see how it could do what you want here. In an ordinary default value, the "a" in "len(a)" refers to a variable of that name in the enclosing scope, not the argument of bisect. A generic delayed-evaluation mechanism wouldn't (shouldn't) change that.