Input() in Python3
harrismh777 at charter.net
Sun Apr 24 03:03:16 CEST 2011
Chris Rebert wrote:
> Well, it pretty much*was* totally removed; it was prone to misuse and
> had very few legitimate uses. It's just that raw_input() also got
> renamed simultaneously.
> What were you using it for? There are often much better alternatives.
For the purpose pretty much described in PEP 3111... education.
Teaching new programmers input, control, arithmetic, logic, and output
works best with simple built-ins. IMHO
I want to teach young folks how to get stuff into their simple programs,
crank on them a bit, and spit out the results... without having to teach
them imports, libraries, &etc.
Keep in mind that some of this stuff is very simple (say trivial) and is
being used to provide a way to get the data 'they are expecting' into
the program easily, with a prompt.
This was the great concept in BASIC, and REXX, and others. The C
language broke with this concept by declaring that the language does not
provide I/O ... only in the standard library, as functions!
The beauty of Python (as I've noted before) is that it can be used in an
uber-sophisticated way... AND it can also be taught to children! Having
thought a little more about that, I suppose that I agree that input()
should return a raw string. After all, the students aren't really
entering "numbers" are they?? They are entering strings of characters
that need to be converted into numbers... easily explained... I was just
surprised to find that issue so hotly debated... again, why remove
something that works.
The wisdom was to use a system call instead, right?
More information about the Python-list