PyPy の Windows バージョンを使用して、Segaran のProgramming Collective Intelligenceを実行します。
著者はこの例を徐々に構築しています。最初に辞書をロードします:
from recommendations import critics
次に、新しい関数を追加することにより、recommendations.pyを変更します。次に、リーダーは次のようにモジュールをリロードすることになっています。
reload(recommendations)
リロードが成功する代わりに、次のエラーが表示されます。
>>>> reload(recommendations)
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: global name 'recommendations' is not defined
私は何か間違ったことをしていますか?