bundles / IPython 9.14.0.dev / IPython / core / magics / basic / BasicMagics / alias_magic
function
IPython.core.magics.basic:BasicMagics.alias_magic
Signature
def alias_magic ( self , line = '' ) Summary
::
Extended Summary
%alias_magic [-l] [-c] [-p PARAMS] name target
Create an alias for an existing line or cell magic.
Examples
:: In [1]: %alias_magic t timeit Created `%t` as an alias for `%timeit`. Created `%%t` as an alias for `%%timeit`. In [2]: %t -n1 pass 107 ns ± 43.6 ns per loop (mean ± std. dev. of 7 runs, 1 loop each) In [3]: %%t -n1 ...: pass ...: 107 ns ± 58.3 ns per loop (mean ± std. dev. of 7 runs, 1 loop each) In [4]: %alias_magic --cell whereami pwd UsageError: Cell magic function `%%pwd` not found. In [5]: %alias_magic --line whereami pwd Created `%whereami` as an alias for `%pwd`. In [6]: %whereami Out[6]: '/home/testuser' In [7]: %alias_magic h history -p "-l 30" --line Created `%h` as an alias for `%history -l 30`. positional arguments: name Name of the magic to be created. target Name of the existing line or cell magic. options: -l, --line Create a line magic alias. -c, --cell Create a cell magic alias. -p PARAMS, --params PARAMS Parameters passed to the magic function.Aliases
-
IPython.core.magics.BasicMagics.alias_magic