Hi Pythonistas!
Im using Python in an educational setting for about a year
now and from time to time i'm stumbling (?) over same
strange behaviour of IDLE which I consider serious drawbacks
in a classroom. One of these is that IDLE cannot react properly
to infinite loops. So nothing else but using the Windows taskmanager
helps and then reloading everything. Today this occured, when
a (quite good) student renamed a loop-variable in the body of
a loop during his program development efforts and forgot to do
this also in the condition of the while-loop. Ooops.
Unfortunately this occured during some sort of exam. Not good!
It seems to me that every mistake you can think of also does occur
eventually especially when teaching programming.
Here I'll report a very special one which occured also during
the exam-assignment this afternoon and which the student could
not resolve on his own.
For me it was interesting, because it did not occur because of a
flaw of IDLE but because of a special powerful feature of the language
itself.
My student wrote this lines:
print "Gib jeweils eine Note ein."
note = ziffer = durchschnitt = input = ("Wenn du fertig bist, gib 0
ein")
eingaben = 0
ziffernsumme = 0
while note > 0:
ziffer = note % 10
note = note / 10
Don't think about the meanig of this but look at the
syntax error.
He got the error message:
Gib jeweils eine Note ein.
Traceback (most recent call last):
File "Z:\6b-20020426\spaula\notendurchschnitt.py", line 10, in ?
ziffer = note % 10
TypeError: not all arguments converted
Naturally it took him a considerable amount of time
to find the cause of this error (which was the = 4 lines above)
O.k. he corrected his mistake and tried to rerun his program,
this time getting the following error-message:
Traceback (most recent call last):
File "Z:\6b-20020426\spaula\notendurchschnitt.py", line 6, in ?
note = ziffer = durchschnitt = input("Wenn du fertig bist, gib 0
ein")
TypeError: 'str' object is not callable
k.o.!
He could not find out what was - or has been - going on, and even
me didn't realize immediately what was the cause of this strange
behaviour.
Now there occur several questions to me (not in order of importance):
1. What do you do, when errors of this type occur? How do you
explain it to students, just beginning to learn programming?
2. How could one develop means, which makes restarting the IDE or
the interpreter obsolete?
As far as I remember there is a good example in the
TeachScheme-Project,
where language-features can be turned on/off according to the level
of knowledge of the students.
One could imagine - in the case obove - to turn off the possibility
of overwriting built-in functions in Python ( does there exist a
switch
concerning this?).
3. Is it possible to rebind input() to it's original built-in function
without restarting the whole machinery.
4. Is there a list somewhere of features to implement / provide for
educational
use of IDLE or some special eduactional-IDE? Or should we start to
collect
ideas in this direction?
My experience tells me (and my opinion is) that it is of crucial
importance
to have a (nearly) foolprove programming environment when working in
school
and trying to promote the use of Python. Interestingly it's not so
important
for the students but much more for the acceptance of the new tool by the
majority of the teachers, who already have to learn so many new things
concerning all the aspects of computer-science and who because of this
show a rather sound(?) amount of inertia when asked to decide for new
ways
of teaching. (From time to time I do Python courses for teachers here in
Vienna).
I'm interested in your opinion about these problems
and also to contribute to this development, but how?
Regards
Gregor Lingl