I'm trying to create a method in python, which accepts 1-n number of parameters, calls the same method on each and returns the result. For example;
(Note this is pseudo code, I'm just typing these methods/syntax on the fly - new to python )
def get_pid(*params):
pidlist = []
for param in params:
pidlist.add(os.getpid(param))
return pidlist
Ideally I would like to do something like
x, y = get_pid("process1", "process2")
Where I can add as many parameters as I want - and the method to be as 'pythonic' and compact as possible. I think there may be a better way than looping over the parameters and appending to a list?
Any suggestions/tips?
pidlist.append(), not.add().