-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Keyword arguments for anonymous functions #2773
Comments
I'm not entirely sold on this being a necessary feature. |
I don't think it's necessary since the same thing can be accomplished with a named function. However, I think there are legitimate reasons to create anonymous functions that take keyword arguments (I ran into this when trying to change PyCall to use keyword arguments instead of the |
I agree with @simonster consistency is good to have here. Anonymous functions should be first-class in every sense, and that means supporting keywords. |
I agree: anonymous functions won't be first-class if they don't share the same abilities as named functions. |
Anonymous function are already non-generic, and therefore different. So I'm not sure the they-should-be-the-same argument goes through. I suspect Jeff might have an opinion on the matter ;-) |
Whether anonymous functions are generic is more of an implementation detail. It might make them different in some respects (e.g. in the future they might be of different types), but the difference shouldn't be so big as to exclude a whole feature like named arguments. |
A question of apply(). For example, if I have
Calling the function by name would give:
Rather nice. How do I make it work in apply, such as I can visualize functions with lots of named keyword arguments being stored in a dictionary somewhere (like a set of pdf rendering options). It would be useful to just apply this dictionary into a function. |
I'm not sure if you can pass keyword args through
|
#485 implemented keyword arguments for named functions. However, I would expect that
would create an anonymous function that takes a keyword argument
b
with a default value"c"
. Instead, I currently getThe text was updated successfully, but these errors were encountered: