Does Python have a function equivalent to scheme’s apply? I notice that Python’s reduce works on functions of two arguments, and applied it recursively, which is very different.
Should I write my own? Is there some module I’m missing?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Python’s equivalent to Scheme’s apply is to use
*and/or**prefixes on the arguments.For example:
The
*prefix is used on a sequence for positional arguments and the**prefix is used on a dictionary for keyword arguments. (This mirrors their usage in formal parameter declarations.)