here is a question about programming in general and more precisely about python: I want to pass a parameter to a function which will sometimes be a type, and sometimes an array of that same type. I would also like to write the body of the function to do something to that one element when it's only one element, and to do it pointwise to every element and return a list of them when it's an array.
Edit: let me add that for now I am using
def foo(cards):
if isinstance(cards, list) == False :
cards = [cards]
for card in cards:
my_stuff
But it doesn't look too pythonic to me and I was wondering if there was another way using unpacking *, or some other operator. Thanks!