根据文档,我应该能够定义一个宏并存储它。然后,该宏将在我下次启动 IPython shell 时可用。但是,它不起作用:
In [4]: print "Foobarbatbizbuzzbonk"
Foobarbatbizbuzzbonk
In [5]: %macro foo 4
Macro `foo` created. To execute, type its name (without quotes).
=== Macro contents: ===
print "Foobarbatbizbuzzbonk"
In [6]: %store foo
Stored 'foo' (Macro)
In [7]: quit()
当我再次启动 IPython shell 时,没有宏:
In [1]: foo
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-d3b07384d113> in <module>()
----> 1 foo
NameError: name 'foo' is not defined
In [2]: %macro
Out[2]: []
有谁知道为什么这不起作用?