Implements javascript's [].concat(...arr)
. Flattens the list(non-deep) and returns a list.
def spread(arg):
ret = []
for i in arg:
if isinstance(i, list):
ret.extend(i)
else:
ret.append(i)
return ret
Here are the input and Output...
spread([1,2,3,[4,5,6],[7],8,9]) # [1,2,3,4,5,6,7,8,9]
This is a Series we will be doing here after exploring small hacks and tips in python...