pydev 上的 python 自动完成功能不好?

发布于 2024-08-25 14:33:56 字数 340 浏览 11 评论 0原文

大约一个月前,我开始学习并爱上Python。深入研究 python、django,现在 Tornado 是我这段时间所遵循的道路。 我选择 pydev 作为 IDE,因为它似乎是最新的,而且我想回到 eclipse,因为我正在使用 Netbeans 来处理 php 和 Java。

我的问题如下: 当我用 php 或 java 编写类时,我声明我的方法和属性。我在其他地方实例化它们并使用它们。自动补全对于java和php来说效果很好,但是对于python,它似乎总是向我建议一堆垃圾,而不是我实例化的类中的真实对象的方法。

你也一样吗?这是 pydev 的限制吗?我做错了什么吗?

预先感谢您为我指明了方向。 马修.

I began learning and loving python about a month ago. Dive into python, django and now Tornado is the path i followed during this time.
I chose pydev as an IDE since it seems to be the most up to date and i wanted to come back to eclipse since i'm using Netbeans for php and Java.

My question is the following:
When i write classes in php or java i declare my methods and properties. I instantiate them somewhere else and use them. The autocompletion works great for java and php but with python, it seems to be always suggesting me a bunch of garbage and never the real object's methods from the class i instantiated.

Is it the same for you ? Is it a limitation from pydev ? Am i doing something wrong ?

Thank you in advance for pointing me in a direction.
Matthieu.

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

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

发布评论

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

评论(3

温馨耳语 2024-09-01 14:33:56

首先确保您的解释器设置正确。

Window | Preferences | Pydev | Interpreter - Python

我在 Linux 上使用 cpython,所以我的解释器位于

  cpython      /usr/bin/python25

库下,确保所有标准 PYTHONPATH 内容都在其中:

System Libs
  /usr/lib/python2.5
  /usr/lib/python2.5/site-packages
  /usr/lib/python2.5/wx-2.8-gtk2-unicode
  /usr/lib/python2.5/lib-tk
  /usr/lib/python25.zip
  etc....

您还可以通过单击“新建文件夹”在此处添加任何非标准路径。

不过,请勿将路径添加到您自己的源代码中。当您配置 pydev 项目、选择“src”文件夹并开始制作模块时,这些应该出现,请参阅此处。

First make sure your interpreter is set up correctly.

Window | Preferences | Pydev | Interpreter - Python

I use cpython on linux so my interpreter is

  cpython      /usr/bin/python25

Under Libraries, make sure all the standard PYTHONPATH stuff is in there:

System Libs
  /usr/lib/python2.5
  /usr/lib/python2.5/site-packages
  /usr/lib/python2.5/wx-2.8-gtk2-unicode
  /usr/lib/python2.5/lib-tk
  /usr/lib/python25.zip
  etc....

You can also add any non standard paths here by clicking New Folder.

Do not add paths to your own source code though. These should come in when you configure a pydev projec, select a "src" folder and start making modules, see here.

一紙繁鸢 2024-09-01 14:33:56

好吧,由于您没有说“垃圾”正在显示什么,所以有点难以猜测,但我相信您指的是对象类中的 __hash__、__str__、 等(是吗?)

如果是这种情况,则已在当前的夜间构建中处理了这个问题(“_”方法仍然会出现,但优先级较低,因此,您可能更感兴趣的方法位于顶部)

Well, as you didn't say what 'garbage' is showing, it's a bit hard to guess, but I believe you mean the __hash__, __str__, etc from the object class (is that it?)

If that's the case, this has been dealt in the current nightly build (the '_' methods will still appear, but with lower priority, so, the methods you're probably more interested in are at the top)

任谁 2024-09-01 14:33:56

Pycharm (http://www.jetbrains.com/pycharm/index.html)除其他外,在自动完成方面比 Pydev 好得多。

Pycharm (http://www.jetbrains.com/pycharm/index.html) is much better than Pydev for auto completion, among other things.

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