> The miscommunication is that you write as though you are correcting me, when in reality you are just adding additional information.

No, it's not a miscommunication. I was correcting you.

> It is for integers. If I said, "it is only for integers" then I could see your point.

I disagree. Python 2's "input" is not for integers; it's for Python expressions.

Let me put it this way: using eval to convert a string to a number is extremely error-prone; literally every kind of error can happen depending on what the user enters, and literally any kind of value can be returned, even a string or even a function (via lambda). It can never lead to good design.

What you should use for inputting integers is the int function on a string grabbed by raw_input. That way, all incorrect entries will raise a ValueError, and you can deal with it properly.

Reply via email to