Does python have a function like call_user_func() in PHP?
PHP Version:
call_user_func(array($object,$methodName),$parameters)
How do I achieve the above in Python?
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.
Picking which object to instantiate isn’t that hard. A class is a first-class object and can be assigned to a variable or passed as an argument to a function.
All works nicely without much pain. You don’t need a “call_user_function” sort of thing in Python