代码缩进错误
This commit is contained in:
@@ -69,7 +69,7 @@
|
|||||||
total = 0.0
|
total = 0.0
|
||||||
for rec in records:
|
for rec in records:
|
||||||
s = Stock(*rec)
|
s = Stock(*rec)
|
||||||
total += s.shares * s.price
|
total += s.shares * s.price
|
||||||
return total
|
return total
|
||||||
|
|
||||||
----------
|
----------
|
||||||
@@ -131,4 +131,3 @@
|
|||||||
|
|
||||||
最后要说的是,如果你的目标是定义一个需要更新很多实例属性的高效数据结构,那么命名元组并不是你的最佳选择。
|
最后要说的是,如果你的目标是定义一个需要更新很多实例属性的高效数据结构,那么命名元组并不是你的最佳选择。
|
||||||
这时候你应该考虑定义一个包含 ``__slots__`` 方法的类(参考8.4小节)。
|
这时候你应该考虑定义一个包含 ``__slots__`` 方法的类(参考8.4小节)。
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user