Beginning programming with Python
nemeth at iqsoft.hu
Tue Nov 16 05:09:25 EST 1999
Janos Blazi wrote:
> I have tried to use Perl in my teaching. It has a very powerful but alas!
> not very simple syntax! To start with, my pupils used to forget the dollar
> signs and Perl does not like that. So this year I shall use Python. We shall
> see. Time will tell, if Python is really better. Maybe my pupils will forget
> the indenting this time? There is actually nothing else you can forget in
I am quite new in Python programming, and I was a bit :-( by understanding that
Python does not have any (even optional) mechanism to enforce the usage of
predeclared variables and functions. The complete lack of compile-time
type-safety of Pythom may be a problem in large projects, which may be the most
serious technical (ie non-marketing) obstacle to Python's becoming a widespread
language like Java.
Let us see an example:
# Module t.py
x = 128
Let us import it in the Python interpreter:
>>> import t
You can see thet the interpreter compiled t.py to t.pyc (or t.pyo) but found no
All typos (typing errors of variable and function names) will be detected ONLY
at runtime! Python is perfect language to write programs fast, but with the
cost of hordes of testers. However this may not be a big problem, because any
piece of software should be thoroughly tested, to make sure that there are no
semantic errors in the application. In the case of Python the applications
should also be tested for "syntactic" errors.
In Python (just like in Smalltalk or in Perl, or in Tcl) there are a lot of
things a programmer may forget.
I am on my way of becomming a Python programmer, but this should not prevent me
from seeing the pitfalls of the language.
A tutor must emphasize these gotchas of any programming language.
Perl has a facility called 'use strict': it is also very poor compared to C++
and Java strict static (ie compile time) system.
The only really large project implemented in Python I found is Zope. Zope is a
fantastic piece of software, and may be regarded as an evidence of my being
totally wrong ;-).
> I feel that it is the right language for teaching.
Anyway, Python is a great language for teaching, but why to learn a language,
which is good only for teachning?! This is the real question you (or the Python
community) should answer!
More information about the Python-list