Is it possible, while using the map() function in python (2.7) to return more than one variable? I tried doing something like this,
class obj1:
def __init__(self,var):
self.var = var
def func1(self,a):
b = [a**2 + y + self.var for y in range(4)]
c = [a**3 + y + self.var for y in range(4)]
return b, c
list1 = [obj1(x) for x in range(10)]
b,c = map(lambda x: x.func1(), list1)
but it says it has too many values to unpack. so I tried to do:
d = map(lambda x: x.func1(), list1)
but it returns a list of tuples instead of the two lists that I wanted.
So, my question is, is there any efficient way of returning two lists from a map function? Thanks in advance.