cascading python executions only if return code is 0
Mark Lawrence
breamoreboy at yahoo.co.uk
Mon Dec 23 07:44:20 EST 2013
On 22/12/2013 23:57, Rick Johnson wrote:
> On Sunday, December 22, 2013 5:02:51 PM UTC-6, Mark Lawrence wrote:
>> On 22/12/2013 22:51, Chris Angelico wrote:
>
>> if a() == 0:
>>
>> if b() == 0:
>>
>> c()
>>
>> I can only see one way that you can possibly intepret it.
>
[snip molehill turned into Himalayas]
Again Frank's original question.
"
I have a requirement where I need to sequentially execute a bunch of
executions, each execution has a return code. the followed executions
should only be executed if the return code is 0. is there a cleaner or
more pythonic way to do this other than the following ?
if a() == 0:
if b() == 0:
c()
"
What is so difficult to understand about "is there a cleaner or more
pythonic way to do this other than the following?" Peter Otten for one
certainly managed to get it, and as always managed to beat me to the draw :(
--
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