20

我刚刚升级到 IPython 2.0.0,tab-complete 的行为似乎发生了变化。(使用 pyreadline 2.0,根据这个问题可能很重要)。

以前,如果我在 之后按 TAB function_name(,IPython 会显示该函数的文档字符串。

现在,我只看到一个下拉列表,我猜想是命名空间中的所有内容,包括:

  • 错误类型
  • 目录中其他笔记本的名称
  • IPython 魔术函数
  • 我定义的其他函数
  • 等等

旧的行为非常有用——我怎样才能恢复它(没有恢复到早期的 IPython 版本)?

4

2 回答 2

25

显然它现在是 Shift-Tab。谢谢@Thomas K。

于 2014-05-16T18:22:13.847 回答
0

对于 Auto-completion,您可以在笔记本的任何位置使用此行;

%config Completer.use_jedi = False

使用这条线将帮助您能够tab用于自动完成。

如果我想打印文档——例如,如果我想打印文档,SVC我可以添加超参数变量。

from sklearn.svm import SVC

然后,

SVC?

输出

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`.

...

对于 Shallowing,您可以使用Shift+Tab来显示任何类的文档或内部的函数()

希望这有帮助

于 2022-01-12T14:21:56.993 回答