Skip to content
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

Merged
merged 9 commits into from Jun 22, 2011
Merged

Get help mid-command #480

merged 9 commits into from Jun 22, 2011

Conversation

takluyver
Copy link
Member

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 for ip.magic.

@rkern
Copy link
Contributor

rkern commented May 29, 2011

I have wanted this too many times to count. +1000 for the idea, but I haven't had time to review the code yet.

@takluyver
Copy link
Member Author

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.

@minrk
Copy link
Member

minrk commented Jun 6, 2011

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)
Copy link
Member

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?

Copy link
Member Author

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.

@minrk
Copy link
Member

minrk commented Jun 22, 2011

If @fperez is okay with adding an arg to the base magic method, then I think this is ready.

@fperez
Copy link
Member

fperez commented Jun 22, 2011

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 :)

@takluyver
Copy link
Member Author

Just to note - this is slightly different in that we're adding an argument to the magic() call itself, but the point about practicality still holds. I'll add it in what's new, then merge.

@fperez
Copy link
Member

fperez commented Jun 22, 2011

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!

@takluyver takluyver merged commit b868e60 into ipython:master Jun 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants