Are two variable length parameters of different types possible? [on hold]
up vote
-4
down vote
favorite
Here is some working code that would take two lists as arguments
def param(funcs,args):
return([func(arg) for arg in args] for func in funcs])
#param([lambda x: x * 2,int],[3.7, 2.5, 9.9, 11.001])
#[[7.4, 5.0, 19.8, 22.002], [3, 2, 9, 11]]
How can I have the same result for a variable number of functions and floats without passing two lists to the param function?
python-3.x functional-programming
New contributor
put on hold as off-topic by яүυк, Gerrit0, hjpotter92, 200_success, Sᴀᴍ Onᴇᴌᴀ 15 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – яүυк, Gerrit0, hjpotter92, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-4
down vote
favorite
Here is some working code that would take two lists as arguments
def param(funcs,args):
return([func(arg) for arg in args] for func in funcs])
#param([lambda x: x * 2,int],[3.7, 2.5, 9.9, 11.001])
#[[7.4, 5.0, 19.8, 22.002], [3, 2, 9, 11]]
How can I have the same result for a variable number of functions and floats without passing two lists to the param function?
python-3.x functional-programming
New contributor
put on hold as off-topic by яүυк, Gerrit0, hjpotter92, 200_success, Sᴀᴍ Onᴇᴌᴀ 15 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – яүυк, Gerrit0, hjpotter92, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
2
Welcome here! Who isfuncs
? More,def param(*func,*args)
isn't valid Python code. The code is broken => it'll probably be closed. Please add more context to your question and fix the code within it.
– яүυк
16 hours ago
2
The idea of multiple variable-length arguments doesn't even make sense: how would this function know wherefunc
ends andargs
begins? Furthermore, Code Review only reviews concrete working code, which this isn't. That said, if you have a particular working function that you think might benefit from a different parameter-passing design, feel free to post that for review, and we might be able to suggest a better way to do it.
– 200_success
15 hours ago
@200_success I thought there might be a way to let the "function know where func ends and args begins" , perhaps by specifying type?
– user31953
12 hours ago
add a comment |
up vote
-4
down vote
favorite
up vote
-4
down vote
favorite
Here is some working code that would take two lists as arguments
def param(funcs,args):
return([func(arg) for arg in args] for func in funcs])
#param([lambda x: x * 2,int],[3.7, 2.5, 9.9, 11.001])
#[[7.4, 5.0, 19.8, 22.002], [3, 2, 9, 11]]
How can I have the same result for a variable number of functions and floats without passing two lists to the param function?
python-3.x functional-programming
New contributor
Here is some working code that would take two lists as arguments
def param(funcs,args):
return([func(arg) for arg in args] for func in funcs])
#param([lambda x: x * 2,int],[3.7, 2.5, 9.9, 11.001])
#[[7.4, 5.0, 19.8, 22.002], [3, 2, 9, 11]]
How can I have the same result for a variable number of functions and floats without passing two lists to the param function?
python-3.x functional-programming
python-3.x functional-programming
New contributor
New contributor
edited 12 hours ago
New contributor
asked 17 hours ago
user31953
11
11
New contributor
New contributor
put on hold as off-topic by яүυк, Gerrit0, hjpotter92, 200_success, Sᴀᴍ Onᴇᴌᴀ 15 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – яүυк, Gerrit0, hjpotter92, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by яүυк, Gerrit0, hjpotter92, 200_success, Sᴀᴍ Onᴇᴌᴀ 15 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – яүυк, Gerrit0, hjpotter92, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
2
Welcome here! Who isfuncs
? More,def param(*func,*args)
isn't valid Python code. The code is broken => it'll probably be closed. Please add more context to your question and fix the code within it.
– яүυк
16 hours ago
2
The idea of multiple variable-length arguments doesn't even make sense: how would this function know wherefunc
ends andargs
begins? Furthermore, Code Review only reviews concrete working code, which this isn't. That said, if you have a particular working function that you think might benefit from a different parameter-passing design, feel free to post that for review, and we might be able to suggest a better way to do it.
– 200_success
15 hours ago
@200_success I thought there might be a way to let the "function know where func ends and args begins" , perhaps by specifying type?
– user31953
12 hours ago
add a comment |
2
Welcome here! Who isfuncs
? More,def param(*func,*args)
isn't valid Python code. The code is broken => it'll probably be closed. Please add more context to your question and fix the code within it.
– яүυк
16 hours ago
2
The idea of multiple variable-length arguments doesn't even make sense: how would this function know wherefunc
ends andargs
begins? Furthermore, Code Review only reviews concrete working code, which this isn't. That said, if you have a particular working function that you think might benefit from a different parameter-passing design, feel free to post that for review, and we might be able to suggest a better way to do it.
– 200_success
15 hours ago
@200_success I thought there might be a way to let the "function know where func ends and args begins" , perhaps by specifying type?
– user31953
12 hours ago
2
2
Welcome here! Who is
funcs
? More, def param(*func,*args)
isn't valid Python code. The code is broken => it'll probably be closed. Please add more context to your question and fix the code within it.– яүυк
16 hours ago
Welcome here! Who is
funcs
? More, def param(*func,*args)
isn't valid Python code. The code is broken => it'll probably be closed. Please add more context to your question and fix the code within it.– яүυк
16 hours ago
2
2
The idea of multiple variable-length arguments doesn't even make sense: how would this function know where
func
ends and args
begins? Furthermore, Code Review only reviews concrete working code, which this isn't. That said, if you have a particular working function that you think might benefit from a different parameter-passing design, feel free to post that for review, and we might be able to suggest a better way to do it.– 200_success
15 hours ago
The idea of multiple variable-length arguments doesn't even make sense: how would this function know where
func
ends and args
begins? Furthermore, Code Review only reviews concrete working code, which this isn't. That said, if you have a particular working function that you think might benefit from a different parameter-passing design, feel free to post that for review, and we might be able to suggest a better way to do it.– 200_success
15 hours ago
@200_success I thought there might be a way to let the "function know where func ends and args begins" , perhaps by specifying type?
– user31953
12 hours ago
@200_success I thought there might be a way to let the "function know where func ends and args begins" , perhaps by specifying type?
– user31953
12 hours ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
2
Welcome here! Who is
funcs
? More,def param(*func,*args)
isn't valid Python code. The code is broken => it'll probably be closed. Please add more context to your question and fix the code within it.– яүυк
16 hours ago
2
The idea of multiple variable-length arguments doesn't even make sense: how would this function know where
func
ends andargs
begins? Furthermore, Code Review only reviews concrete working code, which this isn't. That said, if you have a particular working function that you think might benefit from a different parameter-passing design, feel free to post that for review, and we might be able to suggest a better way to do it.– 200_success
15 hours ago
@200_success I thought there might be a way to let the "function know where func ends and args begins" , perhaps by specifying type?
– user31953
12 hours ago