具有自动完成功能的免费 Python 编程环境

发布于 2024-12-14 04:08:24 字数 201 浏览 3 评论 0原文

我已经研究过大多数 IDE。我已经将 vim 设置为使用自动完成功能,并且现在正在使用它。但是,我似乎无法让它像 Visual Studio 与 .NET 一样工作。自动完成似乎只在某些情况下起作用,它只显示方法而不显示它们采用的参数。对我来说几乎没用。

我想要的是一个弹出窗口,它将向我显示所有可用的方法及其采用的参数。与 .NET 编程时的 VS2010 感觉差不多。

I've looked at most of the IDE's out there. I've set up vim to use autocompletion and I'm using it right now. However, I can't seem to get it to work like Visual Studio with .NET. Autocompletion seems to work only in certain cases and it only shows methods and not what parameters they take. It's pretty much unusable to me.

What I'm after is a pop-up that will show me all methods available and the parameters they take. Pretty much the feel of VS2010 when you're programming .NET.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

权谋诡计 2024-12-21 04:08:24

在像 Python 这样的动态语言中,你不会像在更显式类型化的语言中那样获得自动完成功能。考虑一下:

 def MyFunction(MyArg):
      MyArg.

当您键入“.”时在 MyArg. 中,您期望编辑器提供带参数的方法列表。这在 Python 中不会发生,因为编辑器完全无法知道 MyArg 可能是什么类型。即使 Python 编译器在编译代码时也没有这些信息。这就是为什么,如果您放置 MyArg.SomeNonExistentFunction() ,直到运行时您才会收到任何类型的错误消息。

如果您写了类似的内容:

 def MyFunction:
      MyObject = MyClass(SomeArg)
      MyObject.

那么足够聪明的编辑器可以在最后的“.”之后提供可用方法的列表。

您会发现那些“有时”提供自动完成功能的编辑器在类似于我的第二个示例的情况下会这样做,而在与第一个示例类似的情况下则不会这样做。使用Python,这已经是您能得到的最好的结果了。

You won't get the kind of autocompletion in a dynamic language like Python that you get in more explicitly typed languages. Consider:

 def MyFunction(MyArg):
      MyArg.

When you type the "." in MyArg., you expect the editor to provide a list of methods with arguments. That can't happen in Python because the editor has absolutely no way of knowing what type (or types) MyArg could possibly be. Even the Python compiler doesn't have that information when it's compiling the code. That's why, if you put MyArg.SomeNonExistentFunction() you won't get any kind of error message until runtime.

If you wrote something like:

 def MyFunction:
      MyObject = MyClass(SomeArg)
      MyObject.

then a smart enough editor can supply a list of methods available after that final ".".

You'll find that those editors that are supplying autocomplete "sometimes" are doing so in cases similar to my second example, and not doing so in cases similar to the first. With Python, that's as good as you can get.

霞映澄塘 2024-12-21 04:08:24

我使用 Eclipse 和 PyDev 扩展已经有一段时间了。那里的自动完成功能确实令人印象深刻,我强烈推荐它。

I've been using Eclipse with the PyDev extension for some time now. The auto-completion there is really quite impressive, I highly recommend it.

澜川若宁 2024-12-21 04:08:24

Gedit 有一个开发者插件,它尝试完成一些语法补全。由于已经提到的原因,它的效果不是很好。我发现它更烦人而不是有用,并在试用几周后将其禁用。

ipython 的新 Qt 控制台具有制表符补全功能,您可以使用一些带有语法帮助和文档字符串的工具提示弹出窗口。例如,请参见下面的屏幕截图。

但是正如大多数人已经指出的那样,您要求的这种事情实际上更适合动态性较低的语言。

在此处输入图像描述


在此输入图像描述

Gedit has a developer plugin which tries to do some syntax completion. For reasons already mentioned, it doesn't work very well. I found it more annoying than helpful and disabled it after a few weeks trial.

ipython's new Qt console has tab completion and you can have some tooltip sort of popups with syntax help and docstrings. See screenshot below for example..

But as most people have already pointed out, this kind of thing you are asking for is really more appropriate for less dynamic languages.

enter image description here


enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文