Python Worst Practices

Ben Finney ben+python at benfinney.id.au
Thu Feb 26 16:23:34 EST 2015


Simon Ward <simon+python at bleah.co.uk> writes:

> On 26 February 2015 00:11:24 GMT+00:00, Ben Finney <ben+python at benfinney.id.au> wrote:
> >You'd better borrow the time machine and tell the creators of Unix. The
> >meme is already established for decades now.
>
> 0 = success and non-zero = failure is the meme established, rather
> than 0 = true, non-zero = false.

That is not the case: the commands ‘true’ (returns value 0) and ‘false’
(returns value 1) are long established in Unix. So that *is* part of the
meme I'm describing.

> None of the above is a good reason to use error *or* success return
> values in Python--use exceptions!--but may be encountered when running
> other processes.

Right. But likewise, don't deny that “true == 0” and “false == non-zero”
has a wide acceptance in the programming community too.

-- 
 \            “Program testing can be a very effective way to show the |
  `\        presence of bugs, but is hopelessly inadequate for showing |
_o__)                              their absence.” —Edsger W. Dijkstra |
Ben Finney




More information about the Python-list mailing list