You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Certain magics are actually just aliases of another, like %hist and %history. In %magic, we show the full help for both, which can be confusing. We should instead indicate which one is an alias and refer the reader to the original for details.
The text was updated successfully, but these errors were encountered:
I agree this would be a nice improvement. In terms of implementation, I think it'd be easiest to add an attribute to the function which stored the name of the alias:
# For a long time we've had %hist as well as %history
@line_magic
def hist(self, arg):
return self.history(arg)
hist.__doc__ = history.__doc__
hist._magic_alias = 'history'
Then %magic can just check for fn._magic_alias and print an abbreviated description:
%history:
Alias for `%hist`.
We could optionally provide a function which did this wrapping automatically:
%alias_magic
A magic function which creates additional magic aliases.
* `%alias_magic myedit edit`: `%myedit` is an alias of `%edit`.
* `%alias_magic mybash bash`: `%%mybash` is an alias of `%bash`.
* `%alias_magic mytimeit timeit`: `%mytimeit` is an alias of `%timeit`, and `%%mytimeit` is an alias of `%%timeit`.
* `%alias_magic --cell mytimeit timeit`: Only `%%mytimeit` is an alias of `%timeit`.
Closesipython#641.
Certain magics are actually just aliases of another, like %hist and %history. In %magic, we show the full help for both, which can be confusing. We should instead indicate which one is an alias and refer the reader to the original for details.
The text was updated successfully, but these errors were encountered: