+1 to this idea -- thanks Chris A!

On Sat, Oct 23, 2021 at 2:01 PM Bruce Leban <bruce@leban.us> wrote:
Here's one way you could imagine writing this today:

    def bisect(a, x, lo=0, hi=lambda: len(a)):
        hi = hi() if callable(hi) else hi
        ...

which is clumsy and more importantly doesn't work because the binding of the lambda occurs in the function definition context which doesn't have access to the other parameters.

However, it will work if there happens to be an 'a' defined in the scope where the function is created.

So that means that it could be VERY confusing if the syntax for an anonymous function is the same (or very similar to) the syntax for delayed evaluation of parameter defaults.

I think Steven may have posted an example of what it would look like.

I"ll also add that looking again, and "arrow" like symbol really is very odd in this context, as others have pointed out, it's pointing in the wrong direction. Not that I have a better idea.

-CHB


--
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython