New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get help mid-command #480
Get help mid-command #480
Conversation
I have wanted this too many times to count. +1000 for the idea, but I haven't had time to review the code yet. |
Glad I'm not the only one who tries to do this! I should have noted above - this PR also includes a couple of more or less unrelated things that happened while I was deciding how I wanted to make it work: some updates to the docstrings in inputsplitter, and an extra tool for the test suite. |
No, you aren't the only one - I think ~99% of users really want this. Great work! I'll do a read through this afternoon, but this is not code I am familiar with. |
@@ -1649,7 +1649,8 @@ class InteractiveShell(SingletonConfigurable, Magic): | |||
[D:\ipython]|1> _ip.set_next_input("Hello Word") | |||
[D:\ipython]|2> Hello Word_ # cursor is here | |||
""" | |||
|
|||
if isinstance(s, unicode): | |||
s = s.encode(self.stdin_encoding) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't we been trying to use encode(enc, 'replace')
for safety in general?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, thanks, Min. Updated.
If @fperez is okay with adding an arg to the base magic method, then I think this is ready. |
ps - and don't forget to add mention of this in the what's new doc, at this point if it doesn't get put in we'll never have time to document it for the release :) |
Just to note - this is slightly different in that we're adding an argument to the |
Ah, right. Still, since eventually we'll want to cleanup the entire magic system, a tiny bit more cruft for such a useful payoff is not the end of the world as far as I'm concerned. Thanks for the good work, as always! |
…put are removed before other transforms are applied.
…a function, and produce useful failure messages.
…a command. Also, ? at the end of a comment should not trigger help.
As pointed out in #98, it's common to be trying to use a method or object, and suddenly realise you want help on it. So it would be nice if:
abc = someobject.someotherobject.somemethod?
Gave you the help for the relevant method. These changes do that.
Also, when you do the above, the command will be placed back at the next prompt. This only applies when the object to be looked up isn't the only thing on the line, and is achieved with a new
next_input
parameter forip.magic
.