Input() in Python3

Chris Angelico rosuav at
Fri Apr 22 08:49:19 CEST 2011

On Fri, Apr 22, 2011 at 4:22 PM, harrismh777 <harrismh777 at> wrote:
> now we get this for input():
>   raw_input("prompt>") --> string

I would have to say that the 2.x behaviour of input() is a mistake
that's being corrected in 3.x. With a simple name like input(), it
should do something simple and straightforward - not eval() the

> to:        a = eval(input("enter a number > "))

Uhhhh.... NO. NO NO NO. What if someone enters "os.exit()" as their
number? You shouldn't eval() unchecked user input!

Chris Angelico

More information about the Python-list mailing list