What to do after Python?

Sheila King sheila at spamcop.net
Sun Feb 18 21:10:52 EST 2001


On Sun, 18 Feb 2001 17:28:00 -0600, Kenneth Loafman <ken at lt.com> wrote in
comp.lang.python in article <mailman.982538961.27262.python-list at python.org>:

:Sheila King wrote:
:> 
:> I teach C++ as a first programming language to high school students, via the
:> AP Computer Science Curriculum. (The course I teach is supposed to be
:> equivalent to a first semester University course for CS majors.) I think that
:> the trick, is to use a carefully selected subset of the C++ language.
:> 
:> Still, I must say that I really enjoy the Python I've been teaching myself the
:> last few months. I do intend to do a number of projects in Python, eventually.
:
:Please also teach the C Standard Library along with C++. 

Um, I don't have time?

: I've seen some
:very poor examples of "reinventing the wheel" happen because the student
:did not even know the basics of the C Standard Library and its
:interaction with the basic elements of C/C++.  Consider one case I found
:where the goal was to remove the last character of a line.  Instead of
:using something like:
:
:   if (strlen(s)) s[strlen(s)-1] = 0
:
:the (7-year C++ veteran) wrote several lines of code that:
:
:   reversed the string
:   trimmed the first char
:   re-reversed the string

My students would never do that. To remove the last character of a string, I
would hope they would do something like this:

s = s.substr(0, s.length()-1);

Or at least, I hope they would. The substr() and length() commands are
something that is included in the apstring class that we use, and I was
recently looking at the standard library, and I believe it also includes these
commands, or something very similar.

I teach them how to work with a variety of classes. And I do tell them about
the standard library. So, when they leave me class, they should be able to
easily learn new classes and utilize them.

:Considering that he was using M$ C++ CString operations, the code took
:several thousand instructions, instead of a just a few.

Hmm. Did you consider the possibility that this was just a function of the
individual involved, and not the fact that he'd been taught C++?

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/




More information about the Python-list mailing list