Wiley Beginning Python 978-0-7645-9654-4 Manuale Utente

Codici prodotto
978-0-7645-9654-4
Pagina di 12
or where something happened, based on the line number in the file. This is one of the features of a good
programming editor, and it makes it much easier to work with programs. 
Using codeEditor’s Python Shell
Before starting to write programs, you’re going to learn how to experiment with the Python shell. For
now, you can think of the Python shell as a way to peer within running Python code. It places you inside
of a running instance of Python, into which you can feed programming code; at the same time, Python
will do what you have asked it to do and will show you a little bit about how it responds to its environ-
ment. Because running programs often have a context — things that you as the programmer have tai-
lored to your needs — it is an advantage to have the shell because it lets you experiment with the context
you have created. Sometimes the context that you’re operating in is called your environment.
Try It Out
Starting the Python Shell
To start the Python shell from codeEditor, pull down the Shell menu in the codeEditor’s menu bar and
select Shell window. This will open a window with the Python shell in it (no surprises here) that just has
simple text, with line numbers along the left side (see Figure 1-1). You can get a similar interface without
using PythonCard by starting the regular Python interpreter, without PythonCard’s additions, by just
typing python on a Unix system or by invoking Python from the Start menu on a Windows system.
Figure 1-1
4
Chapter 1
04_596543 ch01.qxd  6/29/05  10:59 PM  Page 4