compute-regions.py

changeset 129
f5ba81a7d86e
parent 128
7a55abeab5fd
child 130
9c68fa498050
equal deleted inserted replaced
128:7a55abeab5fd 129:f5ba81a7d86e
27 block_coordinate = lambda x: int(x / self.block_factor) 27 block_coordinate = lambda x: int(x / self.block_factor)
28 return block_coordinate(point.x), block_coordinate(point.y) 28 return block_coordinate(point.x), block_coordinate(point.y)
29 29
30 def minmax(data): 30 def minmax(data):
31 ''' 31 '''
32 From: http://code.activestate.com/recipes/577916-fast-minmax-function/
32 Computes the minimum and maximum values in one-pass using only 33 Computes the minimum and maximum values in one-pass using only
33 1.5*len(data) comparisons 34 1.5*len(data) comparisons
34 ''' 35 '''
35 import itertools 36 import itertools
36 it = iter(data) 37 it = iter(data)

mercurial