-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More user-friendly lambda functions #4
Comments
I like the idea of adding a
I'm not so sure about shortcuts for "implicit lambdas". The |
Thanks @plammens for this relevant comment ! Indeed global and local names must be taken into account, and depending on usage some people will wish to resolve them, resolve some of them, or resolve them with a different The limitation with my For this reason I would rather prefer to have in the stdlib some helper function That way it would remain optional and allow for the various flexible usages you mention concerning globals and locals. What do you think ? |
Our original need was to raise user-friendly errors in case of failed validation. It is very frequent that a validation operation just consists in a few operations, and it is therefore quite convenient to express it as a lambda function. There are two main issues then:
validation failed: x > 2 returned False
".lambda <vars>:
prefix is sometimes a bit cumbersome. Being able to import or create special input symbols so thatlambda
is implicit would make the code more readable.For this reason I created
mini-lambda
but it has some major limitations (one input only, and some python operators can not be used because the corresponding magic method has too much constraints).Maybe we could propose a PEP about
See also this stackoverflow post
The text was updated successfully, but these errors were encountered: