I have a function that should be able to take either many string arguments as *args, or a list of strings as an argument. For example:
def getStuff(*stuff):
  for thing in stuff:
    print(thing)
getStuff("cat", "mouse", "dog")
getStuff(animals)
I would like for this function to able to produce the same result if I call it either way. There is the following very simple method that I'm currently using but doesn't make for the cleanest code:
def getStuff(*stuff):
  if type(stuff[0]) != list:
    for thing in stuff:
        print(thing)
  else:
    for thing in stuff:
      for subthing in thing:
        print(subthing)
Is there a simple way to accomplish this? I'm looking for python best practices.
 
     
     
    