I have tried and errored a reasonable amount of times

Chris Angelico rosuav at gmail.com
Thu Sep 4 04:03:06 CEST 2014


On Thu, Sep 4, 2014 at 11:54 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> although the
> analogy is terrible for ∨. 1+1 = 2, not 1.

I wouldn't say terrible. Unclear perhaps, but functional. Try this exercise:

false, true = 0, 1 # or use an old Python
if true + true:
    print("true OR true is true")

As long as you accept that any non-zero value is true, and as long as
'and' and 'or' are the only operations you use (you can add 'not' as
long as it's defined the same way: "false if x else true"), addition
for or works fine.

ChrisA



More information about the Python-list mailing list