Ian Kelly wrote:
> No, 3 is merely true, not True. True is just the name of a particular
> singleton object that is also true.
Sometimes I distinguish between "true" and "True", where True is the
canonical boolean true object, but I prefer to refer
to "true-like", "true-ish", or "truthy" objects
gs and containers (including strings, tuples, lists, dictionaries,
> sets and frozensets). All other values are interpreted as true."
Yep, and I expect this to bite S4H shortly, when he can't understand why
the following are not all of the same truthiness:
0 (falsey - numeric 0)
[] (
On Thu, Oct 23, 2014, at 10:56, Simon Kennedy wrote:
> Thanks everyone. That's a thorough enough explanation for me.
You should know, though, that numeric values equal to 1 (and 0 for
False) _are_ == True. This works for dictionary keys, array indexes,
etc. The bool type is actually a subclass of
On 10/23/2014 04:47 PM, Alain Ketterlin wrote:
Simon Kennedy writes:
Just out of academic interest, is there somewhere in the Python docs where the
following is explained?
3 == True
False
if 3:
print("It's Twue")
It's Twue
i.e. in the if statement 3 is True but not in t
Thanks everyone. That's a thorough enough explanation for me.
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Oct 23, 2014 at 9:30 AM, Simon Kennedy wrote:
> Just out of academic interest, is there somewhere in the Python docs where
> the following is explained?
Yes:
https://docs.python.org/3/library/stdtypes.html#truth-value-testing
https://docs.python.org/2.7/library/stdtypes.html#truth-valu
Simon Kennedy writes:
> Just out of academic interest, is there somewhere in the Python docs where
> the following is explained?
>
3 == True
> False
if 3:
> print("It's Twue")
>
> It's Twue
>
> i.e. in the if statement 3 is True but not in the first
https://docs.python.or
On 10/23/2014 04:30 PM, Simon Kennedy wrote:
Just out of academic interest, is there somewhere in the Python docs where the
following is explained?
https://docs.python.org/3/library/stdtypes.html#truth-value-testing
3 == True
False
as opposed to:
https://docs.python.org/3/library/stdtyp
On Thu, Oct 23, 2014 at 8:30 AM, Simon Kennedy wrote:
> Just out of academic interest, is there somewhere in the Python docs where
> the following is explained?
https://docs.python.org/3/reference/expressions.html#booleans
3 == True
> False
if 3:
> print("It's Twue")
>
> It's
Just out of academic interest, is there somewhere in the Python docs where the
following is explained?
>>> 3 == True
False
>>> if 3:
print("It's Twue")
It's Twue
i.e. in the if statement 3 is True but not in the first
--
https://mail.python.org/mailman/listinfo/python-list
10 matches
Mail list logo