cascading python executions only if return code is 0

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Dec 23 10:22:17 EST 2013


On 23/12/2013 15:12, Dennis Lee Bieber wrote:
> On Mon, 23 Dec 2013 13:33:08 +1100, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> declaimed the following:
>
>> Roy Smith wrote:
>>
>>
>>>          else:
>>>              assert 0, "can't create picker (classes = %s)" % classes
>>
>> ¡Ay, caramba! I was with you until the very last line. The above code is
>> possibly buggy and inappropriately designed. (I may be completely
>> misinterpreting this, in which case feel free to ignore the following
>> rant.)
>>
>
> 	I'd think the biggest problem with this is that if one runs Python with
> optimization turned on, the assert statement itself vanishes, leaving one
> with an empty else clause...
>
> 	Try debugging that problem!
>

I'll pass on that one :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list