I have a function foo
that returns two values. Currently, I am iterating through a list as follows:
A,B = [],[]
for i in arr:
a,b = foo(i)
A.append(a)
B.append(b)
Is there a more pythonic way to accomplish this? I thought the following was sort of ugly, but maybe it's the best way?
A,B = np.array([foo(i) for i in arr]).T