Call two or more functions with one args.
one last Day
إلى python-dev-owner
قبل 7 أيام

#While reading about functions in mathematics, a figure representing the sum of two functions caught my attention.
#I found it would be useful to add it in the next version of Python. Of course, what is meant by collecting the two functions in mathematics is to collect the results of the two functions, but here I mean to collect the two or more functions on one args.
#If all the added functions have the same parameter and the same number of them, then the form x = multi (fun1,func2)(3.5) will be very useful

def multi (a,b,s):
#func to return multi func with one arg or multi args
#Operations are performed on all parematers that represent functions using one args, with the condition that all functions accept the same number of variables

#In this case, it is just a function that we want to develop to avoid possible errors and build several scenarios
#It has to be something like that
# x = multi (func1,func2)(3.5)
# and return list of func results or None for func with None return
# print(x[0], x[1])
a1 = a(s)
b1 = b(s)
return ([a1,b1])

def a (s):
return s
def b (s):
return s+1

= multi(a,b,2)
print(x[0], x[1])