Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 549e34c commit d2f6974Copy full SHA for d2f6974
1 file changed
Doc/library/collections.rst
@@ -905,15 +905,15 @@ functionality with a subclass. Here is how to add a calculated field and
905
a fixed-width print format:
906
907
>>> 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)
+ __slots__ = ()
+ @property
+ def hypot(self):
+ return (self.x ** 2 + self.y ** 2) ** 0.5
+ def __str__(self):
+ return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot)
914
915
>>> for p in Point(3, 4), Point(14, 5/7):
916
- print(p)
+ print(p)
917
Point: x= 3.000 y= 4.000 hypot= 5.000
918
Point: x=14.000 y= 0.714 hypot=14.018
919
0 commit comments