
I have looked more properly at deferred evaluation and late-bound defaults. Deferred-eval is overkill for what I need and isn’t likely to come about soon, while deferred only solves a very small part of what I am looking at. Also, it lacks ability to enforce default from outside, which is a bit of a dealbreaker to me. Sooo… I have come up to a conclusion that what would shut me up is a shorthand syntax for lambda. Either: 1) Ability to assign it to a different name or MUCH MORE preferably 2) lambda: expr() == `expr()` == ?(expr()) == ???. Anything concise and sensible would do. lambda pretty much does the trick, but syntax is too awkward to use for such applications. And ideally, adding 2 builtin(or imported from stdlib) functions: `Break` and `Continue`, which if called act as `break` and `continue` statements.
On 20 Jul 2023, at 11:11, Greg Ewing <gcewing@snap.net.nz> wrote:
On 20/07/23 6:30 pm, James Addison via Python-ideas wrote:
result = default if bar is None else bar or if you prefer result = bar if bar is not None else default
Would it shut anyone up if we had another logical operator:
x otherwise y
equivalent to
x if x is not None else y
?
-- Greg
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/R55FL6... Code of Conduct: http://python.org/psf/codeofconduct/