4 ms·
As it stands, help is a string. If help does what you suggest, it becomes a keyword. Then it has to go into the parser. Then somebody has to maintain that code
by shadytrees 18y ago
As it stands, help is a string.
If help does what you suggest, it becomes a keyword. Then it has to go into the parser. Then somebody has to maintain that code. And document it. And the backend code gets larger.
If it doesn't become a keyword, it becomes an exception to the rule. Which means you'll have to deal with edge cases where the user tries to fudge with the value of `help`. Does it act like a keyword? Should it have different semantics? Should there be a separate category for it?
And then: What about `quit`? And `exit`?
The problem with DWIM is that doing what you mean in one case can create doing-what-you-don't-mean in several other cases.
- jodrellblank 18y agoAs it stands, help isn't a string - if it was then typing help() would tell you that strings aren't callable. It's a <class site._Helper> So as well as printing that message, it could go into interactive help mode. Since you're only going to want that at the console it could only happen at the console, and since you typed "help" you probably want "help", that would be ... helpful. The real problem with DWIM is that nobody else has the same WIM. (But that's not my problem, because it's all of you who are wrong. ;)