On Wed, Oct 5, 2011 at 5:17 PM, Terry Reedy email@example.com wrote:
On 10/4/2011 10:21 PM, Guido van Rossum wrote:
We also have str.index which raised an exception, but people dislike writing try/except blocks.
Given that try/except blocks are routinely used for flow control in Python, and that some experts even advocate using them over if/else (leap first), I am tempted to ask why such people are using Python. I am curious, though, why this exception is more objectionable than all the others
str.index is a "little" method that it is tempting to use inline, even as part of a comprehension. There isn't a good way to handle exceptions without a full statement.