>>> \({\bf\tt change\_and\_print\_global()}\)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in change_and_report_it
UnboundLocalError: local variable 'animal' referenced before assignment
>>> \({\bf\tt change\_and\_print\_global()}\)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in change_and_print_global
UnboundLocalError: local variable 'animal' referenced before assignment
初版第2刷
-
p.180
>>> \({\bf\tt duck.color = \text{'green'}}\)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'color'
>>> \({\bf\tt duck.color = \text{'green'}}\)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Duck' object has no attribute 'color'