[Edu-sig] The fate of raw_input() in Python 3000

John Zelle john.zelle at wartburg.edu
Wed Sep 6 15:53:20 CEST 2006


On Wednesday 06 September 2006 8:00 am, Arthur Siegel wrote:
> Being dispassionate on the issue itself - I have *never* used
> raw_input() and, as it happens, I am generally literate enough at this
> point so that the intentions of sys.stdin.readline is *clearer* to me
> than is raw_input() - I am disturbed by the tone of the discussion.
>
> Guess I prefer the all-in-the-family temper tantrum, then the calm and
> dispassionate threat - explicit or implicit.

I have no idea what you mean here. Speaking only for myself, I am simply 
stating that a language that requires me to use an extended library to do 
simple input is less useful as a teaching tool than one that does not. I also 
gave arguments for why, as a programmer, I find it less useful.  You have not 
addressed those arguments.

>
> I guess I view it also as an example of the result of Python promoting
> itself to the educational community in the wrong way, and on the wrong
> footing, from day one - as the easy alternative, rather then as the
> literate and productive alternative, the *best* alternative for getting
> a certain class of problems solved in the least circuitous way.

So you are saying it's less circuitious when writing a simple script that 
needs a bit of user interaction that I have to include an import statement 
and split a single logical operation (asking a user for input) into two 
steps: first printing a prompt and then calling on my imported library to do 
the input? I can't say as I follow that logic.

To me, one of the beauties of Python is how it mirrors the way I think about 
algorithms and how I teach my students to think about algorithms. "Get a 
number from the user" is a primitive operation in my thinking, having a 
built-in that allows this makes for a straightforward translation from 
thought to code. That's efficent both in terms of programmer productivity and 
student learning.

>
> In particular, the kinds of real world problems a student might want to
> solve or explore.
>

Again, I would like to see the distribution breakdown of this feature in 
extant code. I think it is widely and heavily used because others view it as 
I do. That's the real world of problem solving. My _point_ is that input and 
raw_input meet exactly this criteria, it helps students to directly solve or 
explore the types of real-world problems that new programmers often want to 
solve.

> Since sys.stdin.readline seems to me *more* literate, I'm OK with it.
>

First up, you ignored my note pointing out that this is not equivalent to 
raw_input, as I have to type another line of code for the prompt. You also 
ignore the fact that you must import sys in order to use this. If by more 
literate, you mean less convenient to use, then I agree with you. My deeper 
philosophical point is that operations essential to computing (input and 
output) should be part of the core language, not things that are imported 
from the library. That's just as true for plain old programmers as it is for 
teaching.

> And will maintain my apparently cloistered, unreal world view of how a
> motivated student might want most to be approached, and her fragility.
>

Just because a motivated student can (and should be able to) learn something 
is not an argument to  go out of our way to put up hurdles, no matter how 
small, to their learning. Both input and raw_input are part of the language 
now (and always have been). Many of us in education see them as being useful 
to new programmers and real world programmers and are outlining our reasons 
for such. If you want to convince us otherwise, then you should have a 
reasoned argument about how this incompatible change significantly _improves_ 
the language for solving your real world problems. I don't really think this 
particular case fits your model of promoting Python for the wrong reasons (a 
case I generally agree with).

Of course, I'm just a unreal ivory-tower academic, feel free to dismiss my 
opinions regardless of the reasoning behind them, pedagogical or otherwise.

--John

-- 
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