Mercurial Hosting > traffic-intelligence
comparison python/moving.py @ 39:e47168f6b694
corrected printing bug
author | Nicolas Saunier <nico@confins.net> |
---|---|
date | Tue, 18 May 2010 17:53:59 -0400 |
parents | 0d321c23d337 |
children | 9f16aee24b7e |
comparison
equal
deleted
inserted
replaced
38:0d321c23d337 | 39:e47168f6b694 |
---|---|
171 def __init__(self, line1, line2): | 171 def __init__(self, line1, line2): |
172 self.positions = [[float(n) for n in line1.split(' ')], | 172 self.positions = [[float(n) for n in line1.split(' ')], |
173 [float(n) for n in line2.split(' ')]] | 173 [float(n) for n in line2.split(' ')]] |
174 | 174 |
175 def __str__(self): | 175 def __str__(self): |
176 return ' '.join(map(utils.printPoint, self.positions[0], self.positions[1])) | 176 return ' '.join([self.__getitem__(i).__str__() for i in xrange(self.length())]) |
177 | 177 |
178 def __getitem__(self, i): | 178 def __getitem__(self, i): |
179 return Point(self.positions[0][i], self.positions[1][i]) | 179 return Point(self.positions[0][i], self.positions[1][i]) |
180 | 180 |
181 def __iter__(self): | 181 def __iter__(self): |