Shapely, map, and reduce

Not the Google MapReduce, that is, but Python's good old map() and reduce(). Waiting on something else this afternoon and just want to write this modestly neat code down for myself.

>>> from shapely.geometry import Point
>>> def union(a, b):
...     return a.union(b)
...
>>> print reduce(union, map(Point, zip(range(3), range(3)))).wkt
MULTIPOINT (0.0000000000000000 0.0000000000000000, 1.0000000000000000 1.0000000000000000, 2.0000000000000000 2.0000000000000000)

Update (2009-10-16): Could be made even shorter using lambda.

>>> from shapely.geometry import Point
>>> print reduce(lambda a, b: a.union(b), map(Point, zip(range(3), range(3)))).__geo_interface__
{'type': 'MultiPoint', 'coordinates': ((0.0, 0.0), (1.0, 1.0), (2.0, 2.0))}