diff options
| author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-02-18 19:40:51 -0500 |
|---|---|---|
| committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-02-18 19:40:51 -0500 |
| commit | 671ce96c6b578fc22a56c8bf7d229039ddafd5a4 (patch) | |
| tree | a8a0fb4ed8f657b22c5c228f268822c39493d940 /docs | |
| parent | 4d9638cce3aabd1294285f1d7747ae8ec0348a51 (diff) | |
| download | cmd2-git-671ce96c6b578fc22a56c8bf7d229039ddafd5a4.tar.gz | |
Updated docs to discuss the new optional "ipy" command.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/freefeatures.rst | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/freefeatures.rst b/docs/freefeatures.rst index 03378a07..2c41c213 100644 --- a/docs/freefeatures.rst +++ b/docs/freefeatures.rst @@ -135,6 +135,42 @@ from the settable dictionary. See see :ref:`parameters`) >>> quit() Python was here > +Using the ``py`` command is tightly integrated with your main ``cmd2`` application +and any variables created or changed will persist for the life of the application:: + + (Cmd) py x = 5 + (Cmd) py print(x) + 5 + +IPython (optional) +================== + +**If** IPython_ is installed on the system **and** the ``cmd2.Cmd`` class +is instantiated with ``use_ipython=True``, then the optional ``ipy`` command will +be present:: + + from cmd2 import Cmd + class App(Cmd): + def __init__(self): + Cmd.__init__(self, use_ipython=True) + +The ``ipy`` command enters an interactive IPython_ session. Similar to an +interactive Python session, this shell can access your application instance via ``self``. +However, the ``ipy`` shell cannot call "back" to your application with ``cmd("")`` and +any changes made will not persist between sessions or back in the main application. + +IPython_ provides many advantages, including: + + * Comprehensive object introspection + * Input history, persistent across sessions + * Caching of output results during a session with automatically generated references + * Extensible tab completion, with support by default for completion of python variables and keywords + +The object introspection and tab completion make IPython particularly efficient for debugging as well as for interactive +experimentation and data analysis. + +.. _IPython: http://ipython.readthedocs.io + Searchable command history ========================== |
