Summary
I often get questions, mostly from Java programmers, about IDEs for Python. In Java there's so much finger-typing that the language wouldn't be feasible without an auto-completion IDE, so it makes sense that a Java programmer would want one when using Python. And they exist, but I don't know many who use them.
Advertisement
Actually, when I'm writing code for a book I don't use an IDE even for Java. I've been tempted many times, but Eclipse, for example, required that you put everything in packages. In the first chapters of Thinking in Java, packages haven't been introduced yet so I can't use them (although I've heard that Eclipse can now just work with the Ant files, so a recent version might work with my code, which comes with automatically-created Ant files).
In addition, I am typically hand-crafting every line of code, so I haven't been as compelled to move to a Java IDE, although it is tempting. From listening to the Java Posse guys, for example, it sounds like Matisse inside Netbeans has finally -- after 10 years, with JavaBeans in the language almost from the beginning -- created a drag-and-drop GUI builder worthy of competing with VB. And in general the autocompletion, refactoring and general automation is certainly something I'd want on a project other than a beginning book.
As far as Python goes, the argument for an IDE is not so compelling. Most people I know just use regular editors. I think the reason is that Python is less verbose. The example I often give is to read each line from a file, which I can do in Python without thinking about it:
for line in file("filename.txt"):
print line
In Java, it's a research project to open a file. In Thinking in Java 4e, I added a utility called TextFile to simplify the process, so you can say:
for(String line : new TextFile("filename.txt")) {
System.out.println(line);
}
And you could probably memorize this easily enough, but it's not standard Java, alas (and there are other interesting ways to use the TextFile class). The point is that Java is more verbose and it really is necessary to have an IDE. But in Python, you can typically figure out what a class does just by using dir(), and you usually have to look up the docs anyway to know what a method does rather than just using it. The compulsion to use an autocompletion IDE is much lower, in my experience, and it seems true for the people that I know, as well.
I guess another way to put it is that productivity in Python is inherent in the language, whereas in Java you really do need the productivity boost that an IDE gives you.
That said, I would be curious as to the IDE (or Eclipse plugin, etc.) that people prefer for Python programming, and what they like about it -- especially if you think it improves your productivity.
When learning Python, 'eric' made the process delightfully easy. For me, the reasoning is that you get a panel where the code is run and tested immediately, and you get some easy indent keys (among other things) along the top. Nothing particularly new, just very well executed and appropriate for the Python language.
That's all very nice but you don't have all of the Python standard libraries memorized, do you? And what about refactoring? If there were a really good IDE for Python we'd all be using it by now.
The thing with dynamic languages is that auto-completion is not that useful compared to static ones where smart type sensitive auto-completion is easy to do. Obviously this is only true because user does all the work and spells out types for the IDE so it can do such marvels like show the "dir()". Don't know how much that is worth at the end but of course it makes sense to take advantage of it.
I use PyDev (http://pydev.sf.net) just b/c Eclipse can show the filesystem in a side panel for quick navigation, and is nice to use with SVN/CVS integration.
Wish something similar ran w/o the memory overhead of Eclipse though... I really liked DrPython, but I need the filesystem/project navigation or I quickly get frustrated working on a project with more than a few files.
While I agree the Java API can be more verbose than necessary, the assertion that Java programmers need IDE's to be productive due to the typing requirements (the keyboard kind) just made my jaw drop. What Java programmers use IDE's for is the ability to explore their libraries without having to page through API documentation. That's assuming there *is* any API documentation. When using a new library in Eclipse I can jump around in its source, control-clicking on methods, classes, instance variables which is an amazing boon.
I hadn't quite realised how much of a boon until doing some bug fixing work with a Ruby on Rails web application that is lamentably low on RDoc (read: virtually none at all). As a newcomer to the code I have no idea what the variables of any given class are - I don't even necessarily know which file class is actually in, it could be spread over several modules. I'll see a statement like "@content.web.pages[@page_name]" (real example I had to nut out recently) and have no idea what "content", "web" or "pages" are (given that [] can be overridden and often is, it doesn't guarantee it's a hash or array). I can't browse to the definitions of these, and looking at init() doesn't help since "content" is passed in as a parameter, so I then have to traipse around trying to find out who actually creates it and what it is. I could use the debugger I suppose and then do the equivalent of a "dir" on a live instance, but this is, to my mind, a totally last resort and not even possible if the application is currently in pieces.
As a heavy user of both the static-typed Java and the dynamically-typed Ruby and Perl, I can see the benefits of both, and I also know that any dynamically-typed language's Achilles heel is the opaqueness of its API to humans and development tools.
This sort of commentary is especially puzzling when it comes from you, Bruce. You're an expert in Java, something many dynamic language advocates are obviously not. Very likely you're a smarter man than I, but every bit of my experience as a developer goes against this sort of argument. What am I missing I wonder?
> As far as Python goes, the argument for an IDE is not > so compelling. Most people I know just use regular > editors. I think the reason is that Python is less > verbose.
I think the reason is most (all?) Python IDEs suck. You will use them for a certain feature e.g. graphical stepwise debugging and live inspection and abandone it for others. All Python IDEs I've seen obtain ridiculous quirks and limitations. Even quite well designed ones such as PyScripter. As it seems Python as a language profits from an outstanding chief designer and a development process where each detail is analyzed meticulously by language experts. Tool support for Python on the contrary is a random activity driven by mediocres. The results are uneven. Take a look at SPE if you want to see a random combination of tools of different quality assembled quite nicely.
So you may be correct that the language itself is so usable that IDE support is a minor issue for Python.
I'm not a full-time Python user, but when I use it, I prefer using ActiveState's Komodo IDE, which gives me everything I need for productive development: syntax highlighting, code intelligence, built in interactive shell and an integrated debugger.
I agree that most people can use Python with a regular editor, and I think that Java users look for IDE just because they usually aren't used to such an editor, since they're coding only in IDE. At least for me that was a reason for looking for a Python IDE, for I'm used to Borland and Microsoft C++ IDEs and I felt a need for the same package for the scripting languages.
Since I found Komodo, it became for me such basic editor, and I use it for all my work with scripting languages, be it Python, Perl or PHP. Recently they've started to support Ruby, but I haven't learnt it yet.
> The thing with dynamic languages is that auto-completion > is not that useful compared to static ones I disagree. It's not that it's "not that useful" but that it's hard to do, and it's even harder to do right, because it requires you to eval the code at each step, keep track of the current binding of each name and use introspection to extract the members and methods.
In fact, autocompletion in dynamic languages is so hard that even the Smalltalk guys don't always get this right, and they're the guys who came up with the Refactoring Browser.
I think a good IDE does a lot more than just finger typing. It's really about improving your productivity, so you could get more work done in less time. The features I find most useful in an IDE (in the order of preference) are:
1) The "Find Usages" command, like the one in NetBeans. This is something that is really useful. For example, if I have an undocumented method or variable, and you have no idea what it does, I click Find Usages and get a list of where it is used. By looking at those usages I see its purpose. Having this feature means I don’t have to read code from the beginning. I just search for an item of interest and snoop around from there.
2) Refactoring: I put this in second place to “Find Usages” only because it is used less often.
3) Visual Debugging: Especially with conditional breakpoints.
Other features like Code Completion, Documentation Display is useful, but not huge productivity boosters like the above.
Mind you, there are very few IDEs that have all these features for any language. NetBeans is one of them. Before NetBeans I preferred Python heavily over Java. But after I started using NetBeans, that gap has narrowed a lot. I feel NetBeans facilities give Java an edge sometimes.
And Python might already have these features! There’s Bicycle Repair Man for refactoring and Winpdb with conditional breakpoints. But I haven’t checked them out yet.
I use Emacs (not XEmacs) for quite everything so it's also my favourite editor/IDE for Python programming. I do not have to use a debugger often but I find useful the http://wingware.com/ IDE.
> 1) The "Find Usages" command, like the one in NetBeans. > This is something that is really useful. For example, if I > have an undocumented method or variable, and you have no > idea what it does, I click Find Usages and get a list of > where it is used. By looking at those usages I see its > purpose. Having this feature means I don’t have to read > code from the beginning. I just search for an item of > interest and snoop around from there. > > 2) Refactoring: I put this in second place to “Find > Usages” only because it is used less often. > > 3) Visual Debugging: Especially with conditional > breakpoints. > > Other features like Code Completion, Documentation Display > is useful, but not huge productivity boosters like the > above. AFAIK, advanced Java IDEs have had these things for quite some time (think IntelliJ IDEA) and improve with each new version, and in the C# land there used to be a Visual Studio 2003 plugin for that kind of stuff, and most of it is now integrated to VS 2005.
Visual Debugging is available in quite a few Python IDEs already (try WingsIDE)
> <p>Actually, when I'm writing code for a book I don't use > an IDE even for Java. I've been tempted many times, but > Eclipse, for example, required that you put everything in > packages.
I realize this isn't the real point of your post but...
I've got some code in Eclipse right now that is not in a package so I'm positive this is not the case in current versions of Eclipse.
Even if Eclipse did require the code be in a package, I fail to see why that's a problem. Just don't put that line in the book.
> I hadn't quite realised how much of a boon until doing > some bug fixing work with a Ruby on Rails web application > that is lamentably low on RDoc (read: virtually none at > all). As a newcomer to the code I have no idea what the > variables of any given class are - I don't even > necessarily know which file class is actually in, it could > be spread over several modules. I'll see a statement like > "@content.web.pages[@page_name]" > (real example I had to nut out recently) and have no idea > what "content", "web" or "pages" are (given that [] can be > overridden and often is, it doesn't guarantee it's a hash > or array). I can't browse to the definitions of these, and > looking at init() doesn't help since "content" is passed > in as a parameter, so I then have to traipse around trying > to find out who actually creates it and what it is. I > could use the debugger I suppose and then do the > equivalent of a "dir" on a live instance, but this is, to > my mind, a totally last resort and not even possible if > the application is currently in pieces. > > As a heavy user of both the static-typed Java and the > dynamically-typed Ruby and Perl, I can see the benefits of > both, and I also know that any dynamically-typed > language's Achilles heel is the opaqueness of its API to > humans and development tools.
This is exactly the kind of problem I have always imagined would exist in dynamically-typed code but I hadn't really had the experience to back it up. I have enough problems following some of the statically typed code I deal with on a daily basis.
Flat View: This topic has 68 replies
on 5 pages
[
12345
|
»
]