简体   繁体   中英

IPython Notebook Tab-Complete -- Show Docstring

I just upgraded to IPython 2.0.0 and the behavior of tab-complete seems to have changed. (Using pyreadline 2.0, which according to this question might matter).

Formerly, if I hit TAB after function_name( , IPython would show the docstring for that function.

Now, I just see a dropdown list of what I guess is everything in the namespace, including:

  • Error types
  • names of other notebooks in the directory
  • IPython magic functions
  • Other functions I've defined
  • etc.

The old behavior was super helpful -- how can I restore it (short of reverting to an earlier IPython version)?

Apparently it's now Shift-Tab. Thanks @Thomas K.

For Auto-completion , you can use this line in any place in your notebook;

%config Completer.use_jedi = False

Using this line will help you to be able to use tab for auto-completion.

If I Want to print out the documentation – for example, if I want to print out the docs of SVC so I can add the hyperparameters variables.

from sklearn.svm import SVC

then,

SVC?

output

Init signature:
SVC(
    *,
    C=1.0,
    kernel='rbf',
    degree=3,
    gamma='scale',
    coef0=0.0,
    shrinking=True,
    probability=False,
    tol=0.001,
    cache_size=200,
    class_weight=None,
    verbose=False,
    max_iter=-1,
    decision_function_shape='ovr',
    break_ties=False,
    random_state=None,
)
Docstring:     
C-Support Vector Classification.

The implementation is based on libsvm. The fit time scales at least
quadratically with the number of samples and maybe impractical
beyond tens of thousands of samples. For large datasets
consider using :class:`sklearn.SVM.LinearSVC` or
:class:`sklearn.linear_model.SGDClassifier` instead, possibly after a
:class:`sklearn.kernel_approximation.Nystroem` transformer.

The multiclass support is handled according to a one-vs-one scheme.

For details on the precise mathematical formulation of the provided
kernel functions and how `gamma`, `coef0` and `degree` affect each
other, see the corresponding section in the narrative documentation:
:ref:`svm_kernels`.

...

For Shallowing you can use Shift + Tab for showing the docs of any class, or function inside ()

Hope this help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM