Robert Amesz sheershion at
Sat Nov 10 17:33:12 CET 2001

Jeff Shannon wrote:

> Robert Amesz wrote:
>> I wrote:
>> > [something]
>> Ignore previous post: I read 'raw_input' where it actually said
>> 'input'. My mistake.
> Though actually, the use of input() is generally not a very good
> idea, and it would be safer to use raw_input() and then convert
> from strings if needed.  In this case, it's not needed, and the
> raw_input result would be better off being compared as a string.

Which is probably why I made that mistake. The use of 'raw_input' is 
not that uncommon, but 'input'? I've never seen 'input' being used in 
a real program. It's not very useful anyway, as input("Expression: ") 
seems to do exactly the same as eval(raw_input("Expression: ")). And 
if I'd need a number, I would use float() or int() on whatever 
'raw_input' returns, and probably protect it with a try-except block 
to boot. You can't go far wrong by never trusting user input.

Robert Amesz

More information about the Python-list mailing list