Skip to content

Commit 926bb37

Browse files
committed
code for chapter 9 'Pythonic objects' in classes/ dir
1 parent 0c15e9a commit 926bb37

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

classes/vector_v5.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@
180180
'<2.0, 2.09439..., 2.18627..., 3.92699...>'
181181
>>> format(Vector([2, 2, 2, 2]), '.3eh')
182182
'<4.000e+00, 1.047e+00, 9.553e-01, 7.854e-01>'
183-
>>> format(Vector([0, 1, 0, 1]), '0.5fh')
184-
'<1.41421, 1.57080, 0.78540, 1.57080>'
183+
>>> format(Vector([0, 1, 0, 0]), '0.5fh')
184+
'<1.00000, 1.57080, 0.00000, 0.00000>'
185185
"""
186186

187187
from array import array
@@ -269,8 +269,8 @@ def __format__(self, fmt_spec=''):
269269
else:
270270
coords = self
271271
outer_fmt = '({})' # <6>
272-
components = (format(c, fmt_spec) for c in coords)
273-
return outer_fmt.format(', '.join(components)) # <7>
272+
components = (format(c, fmt_spec) for c in coords) # <7>
273+
return outer_fmt.format(', '.join(components)) # <8>
274274

275275
@classmethod
276276
def frombytes(cls, octets):

0 commit comments

Comments
 (0)