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

typing ? on the command line brings up IPython help #9015

Closed
burcin opened this issue May 22, 2010 · 15 comments
Closed

typing ? on the command line brings up IPython help #9015

burcin opened this issue May 22, 2010 · 15 comments

Comments

@burcin
Copy link

burcin commented May 22, 2010

I was looking over the shoulder of a new user as he started Sage for the first time and typed ? on the command line. This shows the IPython help text which doesn't mention Sage at all.

We should change this to show the text displayed with help().

Printing some more information when someone types help without the parenthesis would also be nice.

sage: help
<function help at 0x1d6fc80>

CC: @vbraun

Component: documentation

Author: Volker Braun

Branch/Commit: 148d8e0

Reviewer: John Palmieri

Issue created by migration from https://trac.sagemath.org/ticket/9015

@burcin burcin added this to the sage-5.11 milestone May 22, 2010
@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@kcrisman
Copy link
Member

comment:5

This is still the case, though now

sage: help
<function sage.misc.sagedoc.help>

Volker, you are currently the Ipython-in-Sage guru - is there an easy way to fix this?

@jhpalmieri
Copy link
Member

comment:6

I was hoping that you could add usage = 'Useful message here' somewhere in DEFAULT_SAGE_CONFIG in sage/repl/interpreter.py`, but that doesn't seem to have any effect. I also tried

diff --git a/src/sage/repl/interpreter.py b/src/sage/repl/interpreter.py
index dbbd683..e748b9e 100644
--- a/src/sage/repl/interpreter.py
+++ b/src/sage/repl/interpreter.py
@@ -502,6 +502,7 @@ class SageCrashHandler(IPAppCrashHandler):
 
 class SageTerminalApp(TerminalIPythonApp):
     name = u'Sage'
+    usage='Useful message here'
     crash_handler_class = SageCrashHandler
     test_shell = False
 

I don't know what else to try right now.

@vbraun
Copy link
Member

vbraun commented Nov 25, 2014

@vbraun
Copy link
Member

vbraun commented Nov 25, 2014

Commit: 1ffbb8a

@vbraun
Copy link
Member

vbraun commented Nov 25, 2014

Author: Volker Braun

@vbraun
Copy link
Member

vbraun commented Nov 25, 2014

New commits:

1ffbb8aoverride IPythons show_usage

@vbraun
Copy link
Member

vbraun commented Nov 25, 2014

comment:9

If you want to figure out what happens you can always run in under the debugger:

sage: ip = get_ipython()
sage: %debug ip.run_cell('?')

@jhpalmieri
Copy link
Member

comment:10

I have two comments. First, I think we should document this way of debugging. I now see that get_ipython() is documented near the top of interpreter.py, which is great. Maybe add a line or two about debugging right there.

Second, do we want to have an easy way of accessing the IPython help? Maybe that information could just be added to the end of the current help string.

I'll see if I can come up with something over the next few days.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 28, 2014

Changed commit from 1ffbb8a to 148d8e0

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 28, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

148d8e0add hint about debugging

@vbraun
Copy link
Member

vbraun commented Nov 28, 2014

comment:12

IMHO it is confusing to have the IPython help crop up. If there is anything that is necessary to use Sage in there then we should add it to our docs.

@jhpalmieri
Copy link
Member

comment:13

I think this is good. Regarding the comment in the ticket description,

Printing some more information when someone types help without the parenthesis would also be nice.

I guess there are ways to do this (see http://stackoverflow.com/questions/10875442/possible-to-change-a-functions-repr-in-python), but I don't know if they're worth it. The banner when you start Sage already says

Type "help()" for help.

Positive review from me. Karl-Dieter?

@kcrisman
Copy link
Member

kcrisman commented Dec 2, 2014

comment:14

I won't have time to look at this, the reason I got involved was just checking whether the ticket was still valid. I'm sure you did due diligence :)

@jhpalmieri
Copy link
Member

Reviewer: John Palmieri

@vbraun
Copy link
Member

vbraun commented Dec 3, 2014

Changed branch from u/vbraun/sole_questionmark_on_the_command_line to 148d8e0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants