3

so far, I only found PyCharm as being able to parse docstring in order to determine a variable's type and enable autocompletion for that variable, e.g.:

def func(arg):
    """
    epydoc style docstring

    @type arg: str
    @rtype: str
    """
    arg.#<-autocomplete enabled, because we know it is a string#
    ...

func('test').#<-autocomplete enabled here too#

Are there other (preferably free) Python IDE that have this functionality? I tried Pydev and Spyder, which do not seem to.

bruno
  • 69
  • 5
  • I just deleted my answer recommending PyScripter (Windows only). I tested and it doesn't support exactly what you're asking for. (Thanks for including a clear example so I could test.) This is a neat feature I should submit it as a feature request to PyScripter. If there is an IDE that you would like to see support this, you could submit a feature request to the project. (If it's an open source IDE you could try to implement it yourself.) – jimhark Jan 27 '13 at 11:56
  • 2
    Since I use PyDev (Eclipse) a lot, I would like this IDE to support this feature. I added 'PyDev' to tags, which seems to be the standard way to submit a question/request to PyDev developers. Unfortunately my skills are not sufficient to implement this. It must be very hard to manage linked types, e.g.: `@type arg: L{MyClass}`. But as I wrote, PyCharm IDE does it! – bruno Jan 27 '13 at 13:39
  • This does work in the latest version of PyDev (was added during the last year). – Fabio Zadrozny Jan 30 '14 at 09:21

3 Answers3

2

This is something that was added on PyDev. The latest release (3.3.3) had a small fix for it, but it should be working since 2.8.0.

Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78
-1

I'm now evaluating PyCharm, and I really like it exactly for this features. Also, it can run under linux and windows, which is another advantage. I don't know any other Python IDE with this autocompletion mechanism.

Unfortunatelly PyCharm is not open source..

sfabris
  • 1
  • 1
-1

Indeed there is a free solution:

Try Jedi! It should understand epydoc type annotations.

At the moment there are plugins for VIM, Emacs and Sublime. Spyder is considering to switch from Rope to Jedi. But that's going to take a while.

Dave Halter
  • 15,556
  • 13
  • 76
  • 103