Show More
@@ -141,7 +141,7 b' Accessing user namespace and local scope' | |||||
141 | When creating line magics, you may need to access surrounding scope to get user |
|
141 | When creating line magics, you may need to access surrounding scope to get user | |
142 | variables (e.g when called inside functions). IPython provides the |
|
142 | variables (e.g when called inside functions). IPython provides the | |
143 | ``@needs_local_scope`` decorator that can be imported from |
|
143 | ``@needs_local_scope`` decorator that can be imported from | |
144 |
``IPython.core.magic |
|
144 | ``IPython.core.magic``. When decorated with ``@needs_local_scope`` a magic will | |
145 | be passed ``local_ns`` as an argument. As a convenience ``@needs_local_scope`` |
|
145 | be passed ``local_ns`` as an argument. As a convenience ``@needs_local_scope`` | |
146 | can also be applied to cell magics even if cell magics cannot appear at local |
|
146 | can also be applied to cell magics even if cell magics cannot appear at local | |
147 | scope context. |
|
147 | scope context. | |
@@ -153,7 +153,7 b' Sometimes it may be useful to define a magic that can be silenced the same way' | |||||
153 | that non-magic expressions can, i.e., by appending a semicolon at the end of the Python |
|
153 | that non-magic expressions can, i.e., by appending a semicolon at the end of the Python | |
154 | code to be executed. That can be achieved by decorating the magic function with |
|
154 | code to be executed. That can be achieved by decorating the magic function with | |
155 | the decorator ``@output_can_be_silenced`` that can be imported from |
|
155 | the decorator ``@output_can_be_silenced`` that can be imported from | |
156 |
``IPython.core.magic |
|
156 | ``IPython.core.magic``. When this decorator is used, IPython will parse the Python | |
157 | code used by the magic and, if the last token is a ``;``, the output created by the |
|
157 | code used by the magic and, if the last token is a ``;``, the output created by the | |
158 | magic will not show up on the screen. If you want to see an example of this decorator |
|
158 | magic will not show up on the screen. If you want to see an example of this decorator | |
159 | in action, take a look on the ``time`` magic defined in |
|
159 | in action, take a look on the ``time`` magic defined in |
General Comments 0
You need to be logged in to leave comments.
Login now