[Python-3000] Pre-PEP: Simple input built-in in Python 3000

Tony Lownds tony at PageDNA.com
Fri Dec 22 18:51:20 CET 2006


On Dec 22, 2006, at 5:45 AM, Andre Roberge wrote:
> raw_input() provides a simple mean to ask a question and obtain a  
> response
> from a user.  The proposed plans for Python 3.0 would require the  
> replacement
> of the single statement
>
> name = raw_input("What is your name?")
>
> by the more complicated
>
> import sys
> print("What is your name?")
> same = sys.stdin.readline()
>

It is even more complicated:

import sys
print("What is your name?", end='')
name = sys.stdin.readline().strip('\r\n')

Another reason that sys.stdin.readline() is not quite as good as  
raw_input is the
fact that it does not use readline.

+1 from me, I've missed raw_input() while playing with the p3yk  
branch already.

-Tony





More information about the Python-3000 mailing list