Suppose the code below:
from functools import partial
import random
def integer(min=1, max=10):
return random.randint(min, max)
def double(min=1, max=10):
return random.uniform(min, max)
if __name__ == '__main__':
p1 = partial(integer, 5, 10)
p2 = partial(double, 5, 10)
for f in [p1, p2]:
f() # I'd like to know if there's a different way to call this like `call(f)` or something
As mentioned in the comment, I'd like to know if there's a way to call f
without using parentheses. One step further, suppose I can call f
without using parentheses, if I would like to pass additional parameters to f
, how do I go about it (like call(f, additional_param_1, additional_param_2)
)?
Thank you in advance for your answers!