Hey,
I have a method which I will accept either a single object or a list of objects. I want to add whatever is passed to another list. Currently, my method looks like this:
def appendOrExtend(self, item):
if type(item).__name__ == "list":
self.list.extend(item)
else:
self.list.append(item)
It seems to me that there should be a more Pythonic way of acheiving this, could you suggest one?
Cheers,
Pete