El sáb, 23 oct 2021 a las 12:57, Guido van Rossum (
I like that you're trying to fix this wart! I think that using a different syntax may be the only way out. My own bikeshed color to try would be `=>`, assuming we'll introduce `(x) => x+1` as the new lambda syntax, but I can see problems with both as well :-).
In the PEP's example:
def bisect_right(a, x, lo=0, hi=>len(a), *, key=None): This reads to me like we're putting "hi" into "len(a)", when it's in fact the reverse. What about: def bisect_right(a, x, lo=0, hi<=len(a), *, key=None): Another option (going back to Chris's original suggestion) could be: def bisect_right(a, x, lo=0, hi:=len(a), *, key=None): Which is the same as the walrus operator, leaning on the idea that this is kind of like the walrus: a name gets assigned based on something evaluated right here. Bikeshedding aside, thanks Chris for the initiative here! This is a tricky corner of the language and a promising improvement.