I’ve been happily using netbeans for C/C++ and python work, which works well enough to not really complain much. Mostly, I want IntelliJ for C code. I find eclipse big and clunky and awkward on the keyboard, and just generally a pain. No Eclipse, I do NOT want to have some sort of “workspace” I want you to just leave things where they are on the disk. Anyway, in Oracle’s infinite wisdom, they are continuing to destroy things that Sun built, and python support has been dropped in netbeans 7. A pity, as netbeans 7 added some nice debugging support for C/C++, and netbeans is much more tightly integrated than eclipse. Still a pale shadow of IntelliJ, but I digress.
So, I had to go and look for some alternative python editors. I’m currently trying out PyDev 2.2 with Eclipse 3.7. It mostly works ok too. It’s capable of running some unit tests, and has the basic highlighting and so on. However, it’s completion is not as good as I would like, nor think it should be. Take this for example.
def something(self): self.mylist = [] # on this line, self.mylist. will give me the full builtin completion for lists self.otherlist = "blah blah".split() # split returns a list, but self.otherlist. has no completion here |
It seems this can be worked around by “pre declaring” the type.
def something(self): self.somelist = [] self.somelist = "blah blah".split() # self.somelist. produces full completion for list here.... |
This is…. odd?
Possibly related is that in python unit tests, I at least, normally use the self.assertEquals(left, right, msg)
form, probably because I came from Java. However, self.assertEqualsassertEquals
is simply an alias for another function (assertEqual = assertEquals = failUnlessEqual
) For whatever reason, this means that I get full completion and parameter help if I use the _real_ implementation, failUnlessEqual
but no advice/help whatsoever if I use the assertEquals form.
Google says this is unhelpful.
- “self.assertEquals python” returns 74300 results
- “self.failUnlessEqual python” returns 35800 results
Update: this assertEquals vs failUnlessEqual is apparently only a problem for python < 2.7. Unfortunately debian stable (squeeze) at present still uses python 2.6 :( In more mundane items, I would _really_ like to know how to get IntelliJ's "ctrl-W" shortcut, for expanding a selection. (From the cursor in the middle of "karl" in the following line, 'self.wop = "this is karl in python".split()', pressing ctrl-w once would highlight 'karl', once more would select 'this is karl in python' (without the quotes), once more with the quotes, and then on to the entire rvalue, then the entire line. This stackoverflow post mentions a solution, but it doesn’t seem to work in PyDev windows, even after getting into the keymap and adding a “Select Enclosing Element” for the PyDev views (or the editor scope? the difference being?) it still doesn’t work.
Oh well, life goes on.
Hi Karl,
Please try the current nightly build… (see: http://pydev.org/download.html for details on getting it) it has fixes for 2 cases you complained:
1. the aliased functions now ‘get’ that they are aliases (so, assertEquals will get the proper parameters)
2. The case for ”.split() was covered (along with some others use-cases). Note that the real problem is that PyDev won’t execute code from any function when doing a code-completion, and as it doesn’t execute the ”.split(), it doesn’t guess what it returns… for now I hardcoded some of the ‘known’ constructs (such as ”.split(), open(), and many others), so, if you have some other construct you’re missing, please let me know.
The select enclosing element is still not implemented in PyDev (so, you won’t be able to have it right now, but please keep an eye on upcoming releases).
Cheers,
Fabio