Oct-05-2019, 04:08 PM
(Oct-05-2019, 09:14 AM)Gribouillis Wrote: I think a good reason forint('4.5')
to raise an exception is that unicode strings appear in the interaction with human users, for example
np = int(input("How many persons are in the room? "))By default, an answer such as 4.5 raises an exception and it seems to me the most consistent thing to do in the general case. It means that if you want your program to be tolerant to inaccuracies in numerical values, you need to implement it explicitly.
It makes sense.
All the best,
newbieAuggie2019
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs