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
{{ message }}
Repository navigation
Add parentheses to license in repl splash text #104471
For as long as I can remember, starting the interactive Python shell shows something like this:
Python 3.11.3 (main, Apr 7 2023, 19:25:52) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
This seems super helpful, right? The only issue is that while "copyright" and "credits" are both strings, "help" and "license" are both functions.
If you want help, you need to call help() or help(thing). And if you want to see the license, you need to call it, as in license().
The current text is thus misleading, omitting the parentheses. But we know this, because if I try to invoke them without parentheses, I get the following:
>>> help
Type help() for interactive help, or help(object) for help about object.
>>> license
Type license() to see the full license text
In other words: We tell people to type "help". Then they do that, and we say, "Actually, you need to type help()." Ditto with license.
I think that the help text should more accurately describe what people should type to get help or see the license. As things now stand, we seem to know that people will mistakenly type the words without parentheses, but instead of telling them the right thing, we're redirecting them when they try it.
If the banner says type "help(object)" and I'm a beginner probably, I'll type help(object) and I will be more confused, trying to understand what is the object class.
IMO, the current string is ok, at least for the help method. Because if you type help you more information is printed:
Type help() for interactive help, or help(object) for help about object.
So, ok typing help I learned that is an interactive help, and I can send an object to get help about object (perhaps that message can be improve)
In the case of license, I agree that would be better have the license() in the banner.
Reacted by Reuven M. Lerner, sunmy2019, Michael M. and Zachary Ware
Good points, all! (And I'm sure that more are coming...)
I didn't have a specific suggestion for what the text should say, just that we shouldn't say "type x" and then when they type x, they're told, "Actually, type x()". That strikes me as confusing.
I agree that pointing to both help() and help(object) is a good idea, although the fact that object is a real thing, and not a placeholder, strikes me as another confusing thing to write. After all, almost no one really wants help on object. I'm not sure how to make it both short and clear. Maybe help(THING), but someone out there will file a PR that THING doesn't exist.
Maybe moving the text that you get from typing help into that line would be useful?
I'm not sure what the right answer is here. I'm just pretty sure that the current text is misleading. You could argue that so few people use it, that it doesn't make a difference, but I'm not super satisfied with that, either.
I'm not sure what the right answer is here. I'm just pretty sure that the current text is misleading. You could argue that so few people use it, that it doesn't make a difference, but I'm not super satisfied with that, either.
Yes, I think this is a difficult change, with lot of possibility.
From my point of view, typing help give us information about itself. I'd add an example in that help's help() text about how to use. And yes I 'd change license by license() in the welcome prompt
@reuven Interestingly, the docstring for function _Helper does say Calling help(thing) prints help for the python object 'thing'. which is similar to your suggestion.
The __repr__ for that same function says help(object) for help about object. I agree with you and @eamanu that beginner users may not realize object is a placeholder and type help(object) instead of help(PLACEHOLDER).
Maybe changing the __repr__ to more closely match the docstring would improve clarity?
@leuneri You may be interested in #94466, a related issue. The current description when entering interactive help is misleading and can cause confusion.
If the plan is to change help's help() text to address this issue I think that #94466 could be addressed at the same time
@reuven Interestingly, the docstring for function _Helper does say Calling help(thing) prints help for the python object 'thing'. which is similar to your suggestion.
I suggest that we simplify the splash line to one suggestion, as unambiguous as possible.
Enter "help" (without quotes) at a >>> prompt for help options.
Then explain the options better. Put the most frequently used option first and properly explain it.
"help(obj)" displays information about a class, which will be obj itself, the one named, or the class of obj.
For example, "help(int)", help('int'), and "help(0)" all display information about class int.
"help()" enters an interactive help mode with its own instructions; enter "quit" to quit that mode.
"credit", "copyright", and "license()" each display information about the respective subject.
Activity
eryksun commentedon May 14, 2023
Note that
copyrightandcreditsare not strings. If they were, their repr wouldn't display as formatted output as it does.licenseis also a_Printer, but it has to be called because its line count exceedsMAXLINES(23).pochmann commentedon May 14, 2023
You PR changes it to:
But typing "help()" enters the interactive help. What if people don't want to do that? How will they now learn about the "help(object)" alternative?
leuneri commentedon May 14, 2023
A consideration could be to add the "help(object)" alternative into the description when entering interactive help
eamanu commentedon May 14, 2023
If the banner says type "help(object)" and I'm a beginner probably, I'll type
help(object)and I will be more confused, trying to understand what is the object class.IMO, the current string is ok, at least for the help method. Because if you type
helpyou more information is printed:So, ok typing
helpI learned that is an interactive help, and I can send an object to get help about object (perhaps that message can be improve)In the case of license, I agree that would be better have the
license()in the banner.reuven commentedon May 14, 2023
Good points, all! (And I'm sure that more are coming...)
I didn't have a specific suggestion for what the text should say, just that we shouldn't say "type x" and then when they type x, they're told, "Actually, type x()". That strikes me as confusing.
I agree that pointing to both
help()andhelp(object)is a good idea, although the fact thatobjectis a real thing, and not a placeholder, strikes me as another confusing thing to write. After all, almost no one really wants help onobject. I'm not sure how to make it both short and clear. Maybehelp(THING), but someone out there will file a PR thatTHINGdoesn't exist.Maybe moving the text that you get from typing
helpinto that line would be useful?I'm not sure what the right answer is here. I'm just pretty sure that the current text is misleading. You could argue that so few people use it, that it doesn't make a difference, but I'm not super satisfied with that, either.
eamanu commentedon May 17, 2023
Yes, I think this is a difficult change, with lot of possibility.
From my point of view, typing help give us information about itself. I'd add an example in that help's help() text about how to use. And yes I 'd change license by license() in the welcome prompt
matthew-fogel commentedon May 27, 2023
I agree this is a difficult change
@reuven Interestingly, the docstring for function
_Helperdoes sayCalling help(thing) prints help for the python object 'thing'.which is similar to your suggestion.The
__repr__for that same function sayshelp(object) for help about object. I agree with you and @eamanu that beginner users may not realizeobjectis a placeholder and typehelp(object)instead ofhelp(PLACEHOLDER).Maybe changing the
__repr__to more closely match the docstring would improve clarity?@leuneri You may be interested in #94466, a related issue. The current description when entering interactive help is misleading and can cause confusion.
If the plan is to change help's help() text to address this issue I think that #94466 could be addressed at the same time
eamanu commentedon May 27, 2023
I did not note it, and IMO is a good option.
terryjreedy commentedon Jun 27, 2023
I suggest that we simplify the splash line to one suggestion, as unambiguous as possible.
Then explain the options better. Put the most frequently used option first and properly explain it.
@iritkatriel Coredev comments needed and wanted.
iritkatriel commentedon Jun 28, 2023
@terryjreedy sound reasonable, but I think if we change where the license and copyright are mentioned we should run this by the lawyers first.
cfbolz commentedon Jul 30, 2024
This issue is half-way fixed in py 3.13 with pyrepl. There, typing
helpwithout parenthesis will open the new help browser.[-]Help text in interactive Python is misleading[/-][+]Add parentheses to `license` in repl splash text[/+]StanFromIreland commentedon Aug 26, 2026
Since
helpwas fixed, I don't think changingcopyrightandlicensematters, most people won't ever use/need them anyway. Closing as won't fix.