Teaching : Python, Scheme, Java...
Jean-Paul Roy
roy at unice.fr
Thu Apr 17 03:55:46 EDT 2003
Hi, snakes,
I'm teaching Scheme in our Univ. to 2nd year students. The cursus is now:
- Java in 1st year
- Scheme in 2nd year
- Java, C++... in 3rd year and above (+ some Scheme to build an
interpreter).
Now, is it a good move to swap from Java to Python in 1st year ? Some of
us find Java a bit heavy for algorithmics. The probable discussion will
be about:
- Python is bad : no static types (it's ok for me)
- Pyhton is bad : recursion limit (I am astonished at that one)
- Python is bad : tail recursion is not iterative (also astonished at
that, I can understand with an interpreter, but compiler ?)
- Python is bad : we are obliged to use message passing paradigm to add
an element to a list (it's ok for me but some of us get angry with
objects for beginners)
- Python is bad : where are classical arrays ? Does:
from array import array
actually imports contiguous arrays ? How can they stay contiguous if
they support adding an element ? Is the access only O(1) amortized ?
Comes from : wanting to play with big arrays of bitmap images.
Aside from that points, a personal question as a Schemer who reads the
Python primer:
- how do you ask if a list is empty ? Is the following ok ?
if L == [] :
- how do you ask if the list has only one element, with time 0(1) ? The
Scheme/Lisp analog is (null? (cdr L))
- more generally, is the length of a list a builtin ? Is the L[k] access
time O(1) with a list ? Probably not. And with a tuple ?
Sorry for so many questions and your time.
But thanks a lot, I guess that Python is a good guy :-)
-jpr
More information about the Python-list
mailing list