From: sto.mar@... Date: 2013-07-31T06:11:35+09:00 Subject: Re: How to check an input IS an integer ? Am 30.07.2013 22:44, schrieb Joel Pearson: >> Other possibilities can easily be found by searching the archives, >> e.g. using Integer(), (which involves rescuing exceptions, which I >> do not like for this use case too much). >> >> Regards, >> Marcus > > Isn't that the whole point of Integer() ? > A user entering invalid input is an Exception. If the programmer wants > to handle it and retry then that is a valid use of Exception handling. I think opinions diverge on this. Some people would argue that you must expect a user to enter invalid input, ergo: no exception. A matter of taste. However: when you decide on Integer(), make sure to rescue the correct exception class, rescuing _all_ exceptions can be problematic (it could e.g. mute exceptions caused by a typo in the code). Regards, Marcus -- GitHub: https://github.com/stomar/ PGP: 0x6B3A101A