[Edu-sig] Python for Algorithms and Data Structures...
Seabrook, Richard
rhseabrook@aacc.edu
Fri, 23 Aug 2002 09:54:43 -0400
I think both views have merit. On one hand, pointers aren't essential
for any particular algorithm, they are a subject in and of themselves
requiring considerable exposure and experimentation to grasp. On the
other, languages that do not have pointers invariably get into some
explanation difficulties sooner or later. For example, in Python some
copying and assignment operations result in two names referring to the
same object, rather than two unique objects. In languages with pointers
this is much easier to explain, once students grasp the idea of a pointer.
Dick S.
-----Original Message-----
From: Markus Gritsch
To: Laurent Pierron; edu-sig@python.org
Sent: 8/23/02 6:18 AM
Subject: Re: [Edu-sig] Python for Algorithms and Data Structures...
Laurent Pierron wrote:
> Hi there...
>
> It's not dfficult to teach Pascal-like record with empty classes.
> Data types is just a matter of convention.
> But how to introduce pointer with Python, pointer is very important in
> computer science because it's very used in C and C++, and C/C++ are
very
> used in computer science ?
In my opinion:
Pointers are not necessary. They are only an artefact of C which you
have to know and to use to write useful code. C++ introduces references
and actually Python also uses references. Python combines this with
mutual and non-mutual data types which is IMHO quite elegant.
The separation of algorithm and data-types is done in C because C has no
method for including algorithms into data-types, i.e. Classes.
Therefore generating this artificially in Python by struct-like Classes
seems not optimal to me. To decouple algorithms and data-types when
really needed, C++ introduced templates. This is only necessary because
of the static typing of C++ variables. Python has dynamic typing, so
there is no need for templates there. Polymorphism is also a strong
technique, but just not supported by C.
My 2c,
Markus
_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig