IDLE automatically indents lines for you

Figure 2-3 shows IDLE's Python Shell window with the miles/kilometers conversion program we introduce in the section, "Writing multiline programs in interactive mode," earlier in this chapter (colorizing is not shown—it's a black-and-white book!).

rt» s-;ti

■*» ai Les ■ to:-]*! 14. ÏD. L_] 1

n-n ■ Piles

■ i.iOï

pf Ld ! _ lJ r-il-tn - ■ U.if ItiLcc

teure' 1 lïllUj kB)

14 -il*t -d IP.m

[ Im: ITH

14 Ultl —J1 }J 1 IS

kllGFTLCri

3D Kllfl —> UJl

kllLBBLJU'M

IE alLci mmj tl.jft

LLIDMLAJEII

v: —> en.*?,

tllCdC-LCl'l

blLUI ■ ■ - »¿.¡li

L-lixriu: y

Figure 2-3: A program and its result in IDLE's Python Shell window on Mac OS. Getting more help for IDLE

Figure 2-3: A program and its result in IDLE's Python Shell window on Mac OS. Getting more help for IDLE

IDLE also has built-in help—look in the Help menu.

A good "getting started" Web page for a recent version of IDLE is here:

http://www.hkn.eecs.berkeley.edu/~dyoo/python/idle_intro

The following pages have additional documentation that you'll find useful, but they are based on earlier versions:

http://www.ai.uga.edu/mc/idle/index.html (based on IDLE 1.0.2)

http://www.python.org/idle/doc (based on IDLE 0.5)

Clever Python Shell features

Here are a couple of time-saving features of IDLE's Python Shell:

• Putting your insertion point or cursor in a line of code and pressing Enter inserts a copy of the code on a new line for editing.

• Typing the opening parenthesis for a function call or method call pops up a small box with a helpful tip or a list of expected arguments.

Was this article helpful?

0 0

Post a comment