In article <[EMAIL PROTECTED]>,
 "John Coleman" <[EMAIL PROTECTED]> wrote:

> Very good point, though one could argue perhaps that when one is
> comparing an object with a truth value then one is implicitly asking
> for the truth value of that object

On the contrary -- since there is normally no need to ever
compare an object with a truth value, then I would interpret
this usage as an attempt to distinguish True or False from
other objects in general.  Some kind of placeholders for
missing values, who knows.  I'm not saying it's a great idea,
but it could work in recent versions of Python.

> This would make code like 'if s: ' equivalent
> to 'if s == True:' with a possible gain in readability. But - as you
> demonstrate the cost of that (minimal) gain in readability would be too
> high. In any event - I think it is mostly bad style to use a
> non-boolean variable in 'if s:' - it reminds me too much of obscure C
> code (though others might disagree).

Others will indeed disagree.  I don't think you'll find
much support for this position.  But it's not as bad as
your notion that "if s == True", where s is not a boolean
object, might represent a gain in readability.  That really
redefines readability.

   Donn Cave, [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to