My function expects a list or tuple as a parameter. In fact, anyway, everything that it does passes it to another function that takes a list or tuple:
def func(arg):
Now I need to change the function a bit to handle the extra element:
def func(arg):
Unfortunately, this will not work: if arg is a tuple, I have to say x + ('a',) .
Obviously, I can make it work by forcing arg to list. But this is not neat.
Is there a better way to do this? I can't get callers to always transfer a tuple, of course, because it just switches to working with them.
python list coding-style tuples
max
source share