-
Notifications
You must be signed in to change notification settings - Fork 371
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
lambda vs fn #910
Comments
Alternative proposal: Just filling up a keyword quota is not good language design. But I already had a good suggestion for this for #739: Require explicit We would also add a This would also probably make #876 easier to implement, or at least make py2hy translations easier to do by hand. |
If |
One of the subissues from #240.
They're not quite the same, but still too similar to need both. Hy's
lambda
will use a Pythonlambda
if it can. When it can't, because there's a statement or multiple lines, it acts exactly the same asfn
. I don't know about Hy, but Python mostly doesn't care to distinguish lambdas from ordinary function objects. You can even setlambda
s as methods for classes.I'm in favor of keeping
lambda
and removingfn
. If there actually is a case where you need a one-expression function and can't use a Python lambda, then you can force a Hy lambda to be a function simply by adding a docstring.If we're OK with not reserving Python keywords as discussed in #899, then after dropping
fn
we can renamelambda
tofn
to keep the shorter alias. Then Hy would treatlambda
like any other symbol. This may be problematic for Python interop, but there are workarounds.The text was updated successfully, but these errors were encountered: