bundles / IPython 9.2.0 / IPython / core / magics / basic / BasicMagics / alias_magic
function
IPython.core.magics.basic:BasicMagics.alias_magic
Signature
def alias_magic(self, line = '')Summary
[1;34m::
Extended Summary
%[0m[1;35malias_magic[0m [[32m-l[0m] [[32m-c[0m] [[32m-p [33mPARAMS[0m] [32mname[0m [32mtarget[0m
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`. [1;34mpositional arguments:[0m name Name of the magic to be created. target Name of the existing line or cell magic. [1;34moptions:[0m -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