Is there a short way to call a function twice or more consecutively in Python? For example:
do()
do()
do()
maybe like:
3*do()
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.
I would:
The
_is convention for a variable whose value you don’t care about.You might also see some people write:
however that is slightly more expensive because it creates a list containing the return values of each invocation of
do()(even if it’sNone), and then throws away the resulting list. I wouldn’t suggest using this unless you are using the list of return values.