I want to call a Python function of no arguments, repeatedly for n times. And return a list.
Is there a more pythonic way than the following?
def repeat(func, n):
return [func() for i in range(n)]
I want to call a Python function of no arguments, repeatedly for n times. And return a list.
Is there a more pythonic way than the following?
def repeat(func, n):
return [func() for i in range(n)]