[Tutor] Beginner @ python
Jerry Jorgenson
jerry at j3iss.com
Sun Sep 14 11:20:02 EDT 2003
On Sun, 14 Sep 2003 09:13:51 -0500
"Anthony Huddleston" <t0ny1 at knology.net> wrote:
> Ok, Silly questions here...:)
> I started learning Python just the other day, mostly because my nephew
> (11yrs old) wants to learn to be a programmer. I like the language and
> the way it flows, but so far I haven't seen anything, that I'm aware of,
> that was written for Windows in Python (i.e. I haven't seen any
> executable Windows programs *.exe). Is that because people "port"
> programs over to the Microsoft OS or does Python always need to have the
> interpreter installed on the machine it's on? Thanks,
> Tony H.
Hi Tony,
Python is a scripting language, not a compiled language (only compiled
languages create .exe binary files. There are three major kinds of
languages (in very simplistic terms--no flames on this please):
interpretive, tokenized, and compiled:
Interpretive: The parser sees an instruction in the source code and
executes it. Think of this as having a set of keys on a key ring and a
series of doors to go through. When you come to a door, you search though
the ring to find the key, you repeat this step at the next door. This
obviously takes time to do. Basic is an example of this kind of language.
Pros: simple structure, few lines of code.
Cons: slow speed. Mostly used for simple start-up jobs (programs that
start other programs).
Complied: The executable is already in a format that is machine readable.
In this case your set of keys is already in the order of the doors you
will encouter, so you only have to go to the next key and turn the lock.
This requires a compile step when creating the program. C, FORTRAN, COBOL
are examples of this kind of language.
Pros: High execution speed, anything can be coded, source code
confidentiality.
Cons: more work to program, more lines of code, a separate compile step.
Used for large production programs, device drivers, kernels and other low
level stuff.
Tokenized: The parser first compiles the source code at each execution
(creates tokens), and then runs the program (to answer your question--yes
Python needs to be installed on the machine where the program runs). This
slows the start-up, but then executes very fast, often it's hard to
distinguish the speed between the compiled program and the tokenized
program. Python, Ruby, and Perl are examples of this kind of language.
Pros: Fewer lines of code, good to high speed.
Cons: More overhead at the start of execution, there is a compile step,
but it's not a separate step, works best at the tasks is was designed for.
Used for start-up jobs, text parsing, and system adminstration,
prototyping.
Jerry
--
Jerry Jorgenson
jerry at j3iss.com
http://www.j3iss.com/
More information about the Tutor
mailing list