Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d2f6974

Browse files
committed
Improve appearance of example code
1 parent 549e34c commit d2f6974

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Doc/library/collections.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -905,15 +905,15 @@ functionality with a subclass. Here is how to add a calculated field and
905905
a fixed-width print format:
906906

907907
>>> class Point(namedtuple('Point', 'x y')):
908-
__slots__ = ()
909-
@property
910-
def hypot(self):
911-
return (self.x ** 2 + self.y ** 2) ** 0.5
912-
def __str__(self):
913-
return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot)
908+
__slots__ = ()
909+
@property
910+
def hypot(self):
911+
return (self.x ** 2 + self.y ** 2) ** 0.5
912+
def __str__(self):
913+
return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot)
914914

915915
>>> for p in Point(3, 4), Point(14, 5/7):
916-
print(p)
916+
print(p)
917917
Point: x= 3.000 y= 4.000 hypot= 5.000
918918
Point: x=14.000 y= 0.714 hypot=14.018
919919

0 commit comments

Comments
 (0)