teaching OO
Stelios Xanthakis
sxanth at ceid.upatras.gr
Wed Nov 24 17:27:57 EST 2004
Gabriel Zachmann wrote:
> My question now is: do you think I should switch over to Python completely
> (next time), and dump all the interesting issues involved in C++'s virtual
> classes, overloading, and templates? (In Python, all of that would just
> disappear ... ;-) )
>
No! Python, being a dynamic language has certain advantages over
compiled languages.
In analogy with C/C++, in python:
* all functions are pointers to functions
* all methods are virtual
* all classes have a virtual table (__dict__)
* all types are "virtual"
* as a result everything is polymorphic and generic
* etc.
Moreover, in python an instance can have it's own methods, so the
class/instance distinction is different than C++ and friends. Python's
classes are more like "flying dictionaries" or something:)
IMO, it would be better to proceed normally teaching OOP with C++ and
dedicate extra lessons on "dynamic/interpreted languages and how can
they do everything OOP'd like to".
Stelios
--------------------
How's the PEP going?
More information about the Python-list
mailing list