VSCode: Show Python docstring of functions when in Debug Console

Question:

I am trying to see the docstring of functions when I am in debug console. But it turns out there is no way. Can someone suggest??

For example, if I hover the mouse over the following, nothing happens. Then if I type CTRL-K CTRL-I, nothing happens.

torch.gather

Then if I do:

help(torch.gather)

It says the evaluation is really slow and might be deadlocked.

I ended up googling for documentation, but that is very inefficient.

Asked By: Tom Bennett

||

Answers:

At present, the "docstring" in VS Code is displayed in "Editor" (The main area to edit your files.), and it does not support displaying "docstring" in "DEBUG CONSOLE", "DEBUG CONSOLE" is used for code interaction And display the debugging results.

enter image description here

If you want to see the content of "docstring" in "DEBUG CONSOLE", please use the command "help(module)" as you mentioned during debugging, it will display the content of the module:

enter image description here

Answered By: Jill Cheng

If I use help(torch.gather) in the vscode debug console, the vscode will crash and I can do nothing.

The better way is that use print(torch.gather.__doc__).

I hope help(torch.gather) can do the same thing in the future.

Answered By: sunshe35
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.