Deprecate input()

Pete Shinners shredwheat at attbi.com
Sun Apr 14 20:17:00 EDT 2002


Raymond Hettinger wrote:
> The help and tutor maillists indicate that the use of input() rather than
> raw_input() is widespread.  I think this function is so harmful and so
> likely to be used that it should be deprecated hasta pronto (right away).
> When really needed, eval(raw_input()) is easy enough to code and explicit
> about what it does.
> 
> <no wink -- this function needs to go away>

i've always wondered why input's default behavior was like this. a 
better function name would be "execute_arbitrary_code". if the user 
wants a certain type of data, 10 out of 10 times they can just convert 
it to the desired type...

input = raw_input #BLARGH
float_val = float(input('Enter A Float'))
int_val = int(input('Enter an Int'))





More information about the Python-list mailing list