[EMAIL PROTECTED] (Aahz) writes: [...] > >I think I was reading the same code recently (epydoc?) and was also > >momentarily horrified ;-) until I realized that it was quite > >deliberately using three-valued logic (True, False, None) for some > >presumably-sensible reason. Since None is false, they had to use > >"is". So, given the need for three-valued logic, it's not as silly as > >it looks. > > My take is that even in that case, one should use "is" only with None. > There is too much ground for bugs with True/False, particularly if you > either intend to work across version *or* you might possibly accept a > user's object (because *they* might be working across versions and > therefore returning 1/0 instead of True/False). I think it's safest to > simply ban this idiom. No exceptions, never.
I tend to agree -- I think I'd define my own constants if I wanted a three-valued logic for use with "is". John -- http://mail.python.org/mailman/listinfo/python-list