summaryrefslogtreecommitdiff
path: root/Lib/collections.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/collections.py')
-rw-r--r--Lib/collections.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/collections.py b/Lib/collections.py
index 51184a430b..c19821bb39 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -120,10 +120,11 @@ if __name__ == '__main__':
@property
def hypot(self):
return (self.x ** 2 + self.y ** 2) ** 0.5
- def __repr__(self):
- return 'Point(x=%.3f, y=%.3f, hypot=%.3f)' % (self.x, self.y, self.hypot)
+ def __str__(self):
+ return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot)
- print Point(3, 4),'\n', Point(2, 5), '\n', Point(9./7, 6)
+ for p in Point(3,4), Point(14,5), Point(9./7,6):
+ print p
class Point(namedtuple('Point', 'x y')):
'Point class with optimized _make() and _replace() without error-checking'