[Edu-sig] The fate of raw_input() in Python 3000
John Zelle
john.zelle at wartburg.edu
Tue Sep 5 15:15:10 CEST 2006
On Monday 04 September 2006 11:03 pm, Toby Donaldson wrote:
>
> I don't care about "input". Its there now and hasn't ever been useful
> to me (eval(raw_input("...")) is a fine alternative), and, more
> importantly, has apparently not caused confusion among students.
>
Again, for similar reasons to those being mentioned, I would like to keep
input as well as raw_input. From a pedagogical perspective, it's best to meet
students "where they're at." Most of my students have studied algorithms and
computation before, but in the context of mathematics. The most
straightforward way to start them out is to take their math background and
turn it into programs. This has the additional motivation of taking some of
the drudgery out of the math.
Given that starting point, it's very natural to write programs that "get a
number from the user". That's what input allows us to do, it interprets any
literal (more generally, expression) provided. Forcing them to use
eval(raw_input()) requires introducing strings as a data type, if they are to
understand it. While strings are simple and easy to introduce early, they are
not as intuitive to my students as numbers. They have never "manipulated"
strings before. They've been crunching numbers since second grade. Numbers,
then strings is the natural progression.
--
John M. Zelle, Ph.D. Wartburg College
Professor of Computer Science Waverly, IA
john.zelle at wartburg.edu (319) 352-8360
More information about the Edu-sig
mailing list