C
Chris Angelico
2) I didn't claim that sys.stdin.readline() was as simple as using
input. I didn't claim it was preferable. I merely presented it as
a refutation to the argument that if you don't use input/raw_input
then you have to use a GUI toolkit.
I'd draw a subtle distinction here, btw. With sys.stdin.readline(),
you're asking to read a line from standard input, but with
(raw_)input(), you're asking to read one line from the console. If
it's been redirected, that's going to be equivalent (modulo newline
handling), but if not, it would make sense for (raw_)input() to call
on GNU Readline, where sys.stdin.readline() shouldn't. Calling a
method on a file-like object representing stdin feels lower level than
"ask the user for input with this prompt" (which might well do more
than that, too - eg it might flush sys.stdout).
ChrisA