Making a better textbook (was Re: The Deitel book)

Magnus Lyckå magnus at thinkware.se
Wed Nov 20 07:30:49 EST 2002


Dave Reed <dreed at capital.edu> wrote in message news:<mailman.1036630990.6540.python-list at python.org>...
> The only thing that
> bothers me about Python for teaching is the lack of enforced private
> members for classes.

Compared to C++? :)

What's the problem with "self.__name = 'Guido van Rossum'" ?
After all, people hardly write 
   coder._Person__name = 'Danny de Vito'
by accident. Code reviews hardly fail to see it either.

You can bypass protection and do very nasty things in C++ in
a way that makes Python feel like Fort Knox. C++ has arbitrary
memory pointers! How can that ever be safe? What Python does
here is to lock the door and put the key on a hook by the door. 
C++ just puts it under the door mat. In both cases this means 
that you can get in if there is an emergency, but gives a clear 
hint that you can't just walk in as you like. It's just more 
error prone in C++.



More information about the Python-list mailing list