-
Notifications
You must be signed in to change notification settings - Fork 133
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
Tuple argument unpacking functionality #163
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
In the first example, would Doing keyword argument for this seems hard, it would mean needing to make the positional argument optional and then checking if it is empty or not versus unpack. I could definitely see including unpack as a utility function, ergonomically speaking using that versus a keyword isn't that different. I'd be curious to see how long the list of functions would be that have 1 positional argument, it is a function, and the function can take multiple arguments. |
I would love a feature like this |
@EntilZha I like what you mentioned about having unpacking for all the functions. What would you think about an automated way of deciding to unpack Scenario1: check the number of mandatory parameters(without default values) required by the provided function. If they are more than one unpack. Scenario2: The tricky part would the following: if you have a function that takes 2 arguments, the second being optional, you don't know if the caller actually wants you to unpack or not. (the second argument could be just a flag that changes the way the processing is performed). If scenario1 sounds ok, anybody in scenario2 which would want unpacking would just have to call their function from a lambda and pyfunctional would see it as needing unpacking. |
http://www.python.org/dev/peps/pep-3113/ removed tuple param unpacking so in Python 3:
more background:
https://stackoverflow.com/questions/21892989/what-is-the-good-python3-equivalent-for-auto-tuple-unpacking-in-lambda
https://stackoverflow.com/questions/11328312/python-lambda-does-not-accept-tuple-argument
Seeing as how unpacking can be implemented explicitly using more functions:
How about building that functionality as an option, directly into all the
seq()
methods? e.g.:Also, a more powerful nested unpacking variation by (ab)using comprehensions:
but not sure that one can be smoothly worked in like
unpack
The text was updated successfully, but these errors were encountered: