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) |