Regarding the magical "or" operator

Greg Ewing greg.ewing at compaq.com
Tue Aug 17 17:12:12 EDT 1999


Tom Christiansen wrote:
> 
> My question is this: have you ever had an urge for it (or a variant)
> to care about the difference between None and any other false value?

Personally I think there should be a separate Boolean type,
and it should be an error to test the truth of any other type.

Alternatively, the Scheme convention could be used, where
the one and only false value is the boolean one, and everything
else is true.

There should be an "else" operator for doing what the "or"
trick is currently used for. The expression

   a else b

should return a unless it is None (and only None), in which
case it should evaluate and return b.

(I don't like the idea of calling it "nor", because that
word already has a meaning in computing which is quite
different.)

Greg




More information about the Python-list mailing list