繁体   English   中英

IPython Notebook Tab-Complete -- 显示文档字符串

[英]IPython Notebook Tab-Complete -- Show Docstring

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

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

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

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

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

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

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

%config Completer.use_jedi = False

使用此行将帮助您能够使用选项卡进行自动完成。

如果我想打印文档——例如,如果我想打印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显示任何类的文档,或()函数

希望这有帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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