@pimms.value<EOL><INDENT>def length(coordinates, closed):<DEDENT>
x = coordinates<EOL>if pimms.is_map(coordinates):<EOL><INDENT>if closed: dfn = lambda k:np.sum(np.sqrt(np.sum((x[k] - np.roll(x[k], -<NUM_LIT:1>))**<NUM_LIT:2>,axis=<NUM_LIT:0>)))<EOL>else:      dfn = lambda k:np.sum(np.sqrt(np.sum((x[k][:,:-<NUM_LIT:1>] - x[k][:,<NUM_LIT:1>:])**<NUM_LIT:2>,axis=<NUM_LIT:0>)))<EOL>return pimms.lazy_map({k:curry(dfn,k) for k in six.iterkeys(coordinates)})<EOL><DEDENT>else:<EOL><INDENT>if closed: return np.sum(np.sqrt(np.sum((x - np.roll(x, -<NUM_LIT:1>))**<NUM_LIT:2>, axis=<NUM_LIT:0>)))<EOL>else:      return np.sum(np.sqrt(np.sum((x[:,:-<NUM_LIT:1>] - x[:,<NUM_LIT:1>:])**<NUM_LIT:2>, axis=<NUM_LIT:0>)))<EOL><DEDENT>
path.length, if path.surface is a mesh, is the length of the given path along its mesh. If
path.surface is a topology, path.length is a lazy map whose keys are the surface names and
whose values are the lengths of the path along the respective surface.