In Python 3, the following returns a map object:
map(lambda x: x**2, range(10))
If we want to turn this object into a list, we can just cast it as a list using list(mapobject)
. However, I discovered through code golfing that
*x, = mapobject
makes x into a list. Why is this allowed in Python 3?