[Tutor] “has a value of True” versus “evaluates true”

Danny Yoo dyoo at hashcollision.org
Thu Nov 13 21:16:19 CET 2014


> Unlike some languages, which choose confusing and arbitrary sets of
> values that count as truthy or falsey, Python encourages a simple
> distinction, something versus nothing. Values which represent some kind
> of "nothing" are falsey:


Hi Steven,

Sure.  I'm not arguing that Python's choices of what's truthy or
falsey isn't consistent or hard to remember.  What I'm saying is that
I personally have to deal with multiple languages at once these days.
(JavaScript is the big one.)  I find one of the points where things
seem needlessly divergent is truthiness.  Given that, I personally
subset the language so that I don't have to spend brainpower on this
issue.

As a confession: I have run and introduced bugs where the root cause
was one language's truthiness table diverging from another.  Given
that I recognise that I make this particular class of mistake a bit
more frequently than I'd like, I try to account for this personal
weakness and engineer for it.  I am not clever.


>> To quote: "Let your statement be: 'Yes, yes', or "no, no': anything beyond
>> these is of evil."
>
> "Have you stopped abusing small children yet?"

:(

I don't understand what your response here means.  My intent in
quoting Matthew 5:37 was purely as a joke, precisely because the quote
is so ridiculously out of context and definitely not intended to apply
to the boolean context of programming languages.  My apologies if you
didn't like that.


More information about the Tutor mailing list