hi,
please, could you explain to me the following syntax of the map function in python?
if isinstance(IN[0], list): OUT = map(list, zip(*[GetRoomBoundaries(x, IN[1]) for x in items]))
else: OUT = GetRoomBoundaries(items, IN[1])
hi,
please, could you explain to me the following syntax of the map function in python?
if isinstance(IN[0], list): OUT = map(list, zip(*[GetRoomBoundaries(x, IN[1]) for x in items]))
else: OUT = GetRoomBoundaries(items, IN[1])
there are a few things happening here -
the one you asked about the map function See explanation here
another is the Zip function See explanation here
Last but not least is the concept of list comprehension that is discussed here
All this of course in an if statement.
try breaking it to small bits that you can test yourself .
My question is only about the syntax of map.
In the script :
map(list, zip(x,y))
So, the (list) is not a defined function , however, no error is returned
Why?
my mistake the list is a builtin function - see here
like this
but actually this can be done like so , not sure why you would need the map as well
thanks
Actually I am wondering too because once I remove it , the script still works.Yet, I thought it could be necessary for some reason.