[Tutor] Defining functions

Michael Dunn misha.dunn at gmail.com
Fri Mar 25 10:21:14 CET 2005

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().



More information about the Tutor mailing list