[Edu-sig] The fate of raw_input() in Python 3000
Andre Roberge
andre.roberge at gmail.com
Tue Sep 5 17:51:07 CEST 2006
On 9/5/06, John Zelle <john.zelle at wartburg.edu> wrote:
> 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.
>
I don't teach CS, nor do I have formal CS "training" (so, take my
comments, including the original issue I raised, with a grain of
salt). However, this progression from number to strings makes sense
to me ... but I don`t like the idea of using input() in its current
form, given the huge potential for misuse. I think some other form,
that takes a string and attempts to extract a number (int or float)
from it would be better suited in a teaching environment - however, it
would have to remain a built-in.
Just to explore some alternative, what about having different names such as
input_number() and input_string()
or
get_number() and get_string()
or
ask_number() and ask_string()
?
André
> --
> John M. Zelle, Ph.D. Wartburg College
> Professor of Computer Science Waverly, IA
> john.zelle at wartburg.edu (319) 352-8360
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
More information about the Edu-sig
mailing list