X Tutup
Skip to content

Fix #384#395

Merged
thomasballinger merged 13 commits intobpython:masterfrom
lohmataja:fix_384
Sep 26, 2014
Merged

Fix #384#395
thomasballinger merged 13 commits intobpython:masterfrom
lohmataja:fix_384

Conversation

@lohmataja
Copy link
Copy Markdown
Contributor

show_source now shows the following error messages:

  • for empty string: ""Cannot get source of an empty string"
  • for a string that matches a built-in: "Cannot access source of "
  • for a string that doesn't match any object: "Cannot get source: X is not defined"
  • if the object doesn't have source code: "No source code found for X"
  • else: the error message from the original inspect.getsource() error

@thomasballinger
Copy link
Copy Markdown
Member

This is great!

  • Special-casing builtins is brilliant - those are the first things you try to look up the source for, and when they don't work it's confusing.
  • I think "Cannot get source of an empty string" is confusing to the user - they didn't try to get the source for >>> "", then just tried it on an empty line. The fact that we represent the current line of the REPL as a string isn't relevant IMO.
  • having different messages for things with source code vs things that don't have it is great

@lohmataja
Copy link
Copy Markdown
Contributor Author

So, for the empty string, any suggestions? Maybe smth like "Type a function name to view its source code"?

@thomasballinger
Copy link
Copy Markdown
Member

Sure, that's good, or "nothing to get source of" or similar. The message you had was good, I just thought the phrase "empty string" could be confusing.

@lohmataja
Copy link
Copy Markdown
Contributor Author

Ok, done. Just pushed an update, now:

  • Error message on empty string: "Nothing to get source of"

thomasballinger added a commit that referenced this pull request Sep 26, 2014
@thomasballinger thomasballinger merged commit ffa49f0 into bpython:master Sep 26, 2014
@thomasballinger
Copy link
Copy Markdown
Member

Looks good, thanks!

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.

4 participants

X Tutup