Feedback wanted on programming introduction (Python in Windows)
Alf P. Steinbach
alfps at start.no
Fri Oct 30 20:07:47 CET 2009
> Python has a lot of baggage which is OK if that's what's going to be
> used, but otherwise is unnecessary confusion: where to put the program
> code (typed in live or in a file, or some combination); whether to call
> the file .py or .pyw; the difference between console and graphical
> programs and so on.
I forgot or decided not to really answer this part earlier, so...
First of all, note that nothing of this is specific to Python.
"Where to put the program (typed in live or in a file)".
This is common to all languages that offer interpreted execution.
It is a feature, not a problem: in *addition* to putting your statements in a
file for later execution, i.e. in addition to creating ordinary programs, you
can explore the effects of statements by typing them at the interpreter.
Storing the statements in a file is to create a "program" in the usual sense.
Typing statements at the interpreter is just interactive use of the interpreter.
Depending on the phase of the moon, one's shoe size and other factors <g>,
what's typed may be called a "program". But it's not a program in the usual
sense, it's not a stored program: it's just interactive use of the interpreter.
Which is very convenient. :-)
"the difference between console and graphical programs"
This is a Windows issue.
Windows makes this differentiation.
Thus, it's there *regardless* of programming language. And for example, it
doesn't matter whether the language offers an interpreter. With C or C++ you
tell the linker which subsystem you want. With Java you use 'java' or 'javaw' to
run the program as respectively console or GUI subsystem. With JScript and
VBScript (script languages bundled with Windows) you use 'cscript' or 'wscript'
to run the program as respectively console or GUI subsystem. With Ruby you use
'ruby' or 'rubyw' to run the program. And so on -- in the end it's always the
bottom level executing machine code program that is console or GUI subsystem.
Do you think I should mention this in the text?
It will make the text longer, and I worked hard to make ch 1 as *short* as
"Whether to call the file .py or .pyw"
This is a feature, that you can relieve the user from the burden of choosing the
most sensible way to execute the file (the user doesn't have to choose whether
to use a console or GUI subsystem version of the interpreter, and the user
doesn't even have to know that there is an interpreter involved).
It's a common convention for many languages (using those languages' filename
extensions, of course), but it's not universal.
Cheers & hth.,
PS: and yes, programming *is* a bit complex! That's what also makes it fun. <g>
More information about the Python-list