Your Development Environment

The right IDE makes all the difference with Python. Although many Python programmers stick to basic editors like vim, it and other vi variants tend to deal poorly with tabs and spaces, and intermixed tabs and spaces can make it nearly impossible to find errors in your programs. Besides, it makes sense to take full advantage of anything that can make your development team more agile than the competition — that's why you went with Python in the first place!

To make everything work as well as possible, you should have your entire development team working with the same IDE and have them use the same number of spaces for their indentation. This will save you reams of problems down the road.

Immunity standardized on WinglDE, although BlackAddr and Emacs also work. Figure 18-1 shows WinglDE 2.0 running on Windows XP. WinglDE has several other features specific to Python that you may not have needed in your C/C++/Java IDE. Primary among these features is a "Source Assistant," which will attempt to guess the type of any variable you click. This can be a time-saving feature for Python, which is dynamically typed, which essentially means that the value of a variable may be different at different times. The key to selecting an IDE is to choose one that runs on all of the platforms your developers use — in this case study, Linux and Windows.

V.' Wing IDE: cnnvawngine.py (c:\cyEwir^horFi^dave\CANVAS\EU<)

File Edit Source Project Debug Tools Mndow l-teJp

□New EbOpen... £3 0)5aveAl | a m B Paste ^ undo & Redo 3Goto Defrntnn @ Indent ®Dedent SJ Match Indent ElProJect Properties ^ Break ► Debuo -a Run To Cursor T5j Steo Into carwösenaine.py csnvasgjgtkz.py I cparse.py dlen_custon>=f.py emaisender.py | ewiprocess.p canvasengne v j set_target_host v ® '

s e If.ta rgeth o s t=targeth o st if self.gui.nodegui:

s elf .gui. n o degui .up dateobj ec t (|tar geth o s t) return def set_first_node (self, node):

111111

Sets this node as the first node in a no delist which we pass to all modules

111111

inHoy=Q

I Browse Current Mocüe v :± • CANVASENG!NEExceptno( @

♦ DEFAULTCOLOR

♦ LINUXEXECVE

♦ LINUXMOSDEF

♦ SÛLARISSPARCUSTENER

♦ SOLARISSPAftCMOSDEF

Invoking: self gui.nodeam update object Likely type mePlfrd fofaullQui, fatenoceciuiuotWe object def update_objectlseJf, object}

Symbol: -arqelhost Cannot infer type

Figure 18-1

Part of choosing your IDE is acknowledging that your IDE should come from the same community as your product. In this case, WinglDE developers can often be found on the pyGTK mailing lists. This lets you know that you'll be well supported when you have problems debugging our own pyGTK-based program. If your product is QT-based, BlackAddr might be a good choice. If you're already familiar with it, Emacs is also quite good with Python, and IDLE is always available as a backup because it comes with Python. Of course, each Python programmer has his or her favorite, and as Python becomes more and more popular, the field of editors and IDEs gets more crowded. CodeEditor (http://pythoncard. sourceforge.net/tools/codeEditor.html) is another favorite.

Was this article helpful?

0 0

Post a comment