[Python-ideas] Default return values to int and float

Jim Jewett jimjjewett at gmail.com
Thu Oct 6 22:32:27 CEST 2011


On Wed, Oct 5, 2011 at 5:17 PM, Terry Reedy <tjreedy at udel.edu> 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.

-jJ



More information about the Python-ideas mailing list