It must be possible to teach generic programming concepts ...
This was possible, as can be seen from the relatively unchanged structure of the handbook. Python has all the control constructs of a typical procedural language4.1. Arrays are implemented in a fairly standard way (although there are some convenient simplifications to make their behaviour more mathematically intuitive). Lists (a multi-element data type) are outside the scope of the course and no harm is done by ignoring them. Although it does not appear in the handbook, formatted output in Python is syntactically almost exactly the same as formatted output in C.
The most profound semantic (rather than syntactic) difference between Python and its alternatives is the implicit declaration of variables and dynamic typing.
Implicit declaration means that memory is allocated by the interpreter the first time a variable is assigned to, without the need for a list of variables at the start of the program. Dynamic typing allows a variable to change type during the program. Students still need to know about the concept of ``type'', as can be seen from the handbook.
Python's interpreter overloads operators, which could be thought
of as hiding too much of the real programming from students. For
4 * "Hello" returns
the expression must return a result this is the only sensible answer.
However, in this particular case, it would be preferable for Python to
raise an error as there is little need for this kind of string
manipulation in an introduction to scientific programming.
As well as being designed with the aim of being a clear language suitable for educational use, it is commonly employed as a scripting language. In that context being extremely high level is indisputably desirable, and it is this that has lead it to gain plaudits as a language suitable for rapid prototyping of large and complex applications. However, if it is desired to teach students the fundamentals of programming the two groups of user can have conflicting interests. The argument that the fundamentals should be taught can be reduced ad absurdum to a claim that programming should be taught in assembler4.2. The course is only two days and a balance must be struck.
I believe that the course finds this balance and A little emphasis in
the handbook forces some more general skills to be used. Most of the
time-saving scripting constructs are not of use in scientific
programming (except arrays' matrix like behaviour). In any case, it is
possible to recreate the difficulties or low-level nature of other
languages using Python (for example, the operator overloading example
above could be rewritten using a
The real danger of Python's extreme high level nature is the introduction of subtle bugs; the interpreter might do something it sees as the right thing, rather than raising an error. By regularly printing variables these bugs are often trivially soluble.
Variables are implicitly typed (you need not specify a type on creation). Function definitions do not require the specification of the type or size of the actual parameters passed. This could be another source of error, but it was not one encountered during the trial. In fact, the lack of a requirement of the specification of array size allowed students to write more general programs.
From talking to students and questionnaire responses, the lack of variable declaration seemed to be one of the things they liked the most about Python. Dynamic typing and implicit variable declaration are indubitably desirable paradigms for a modern VHLL (like Matlab, IDL, Perl, Python, etc.) to follow. Whether student's programming education is best-served by the use of a language with such features is less clear.
The answer to the first question the trial was designed to address is ``yes''; It fulfils all the criteria listed in Section 1.2.3. Python has problems that will be discussed in more detail later, but there are no fundamental barriers to its use as the principal teaching language; its use is feasible.
REPEAT...UNTIL, which can be replicated with
whilein all but the most obscure circumstances.