Python Worst Practices

Simon Ward simon+python at bleah.co.uk
Fri Feb 27 17:05:59 EST 2015



On 27 February 2015 20:06:25 GMT+00:00, Simon Ward <simon+python at bleah.co.uk> wrote:
>
>I mentioned the true and false. OK, so it's a meme, but it's based on a
>false (pun intended) understanding of exit status codes. That success
>evaluates to true and failure evaluates to false does not mean the
>values of truth and falseness are inverted. No programming language
>other than that provided by system shells I have used evaluates 0 to
>true.
>
>The shell case is unique because it typically runs processes and has to
>deal with exit status codes. It feels quite natural to me that, if
>COMMAND completes successfully (exit code 0) then writing "if COMMAND ;
>then : true bit ; else : false bit ; fi" should execute the true bit,
>but that doesn't mean all boolean logic is inverted.

I pointed my partner at this thread, and she said we were using too many of the same words to mean different things. To quote: "you're both using yes or no terms to answer a question that doesn't necessarily need a "yes" or "no" answer.

It's still a point of discussion (existentialism next!) but the basic idea seems to be that once the exit code is understood as an error value it is not necessarily true or false. This is what I tried to say originally so I don't disagree.

My partner is not a software developer by profession, she deals with food and nutrition and bakes nice cakes. I have encouraged her to learn Python to help with some of her work, which involves calculation of nutritional values and a lot of statistics. Programming idioms should not be lost on her, but she can, and does, point out the bits she is unfamiliar with our has trouble understanding.

Simon



More information about the Python-list mailing list