Something I've always wondered: if input() is so dangerous, why is it
there? What valid uses does it have in the wild?

I ask this because this confusion comes up a lot: people expect
input() to return a string and it throws them when it doesn't. We all
just learn to use raw_input(), and to forget about input(). But if you
really needed the current input() function, isn't eval(raw_input())
the same thing? And it leaves you space to check the input string for
anything stupid or dangerous before you feed it to eval().

Perplexed,

Michael
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to