Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79539

Re: Truthiness

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.python
Subject Re: Truthiness
Date 2014-10-23 16:07 +0000
Organization A noiseless patient Spider
Message-ID <m2b93i$u0g$3@dont-email.me> (permalink)
References <61f0b04c-b827-4c03-b55d-4d5bd85b56f6@googlegroups.com> <87bnp23ksg.fsf@dpt-info.u-strasbg.fr>

Show all headers | View raw


On Thu, 23 Oct 2014 16:47:27 +0200, Alain Ketterlin wrote:

> says: "In the context of Boolean operations, and also when expressions
> are used by control flow statements, the following values are
> interpreted as false: False, None, numeric zero of all types, and empty
> strings 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)
[] (falsey - empty set)
"" (falsey - empty string)
[""] (truthy - non empty set)
[0] (truthy - non empty set)

-- 
Denis McMahon, denismfmcmahon@gmail.com

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Truthiness Simon Kennedy <sffjunkie@gmail.com> - 2014-10-23 07:30 -0700
  Re: Truthiness Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-23 08:45 -0600
    Re: Truthiness Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-24 11:42 +1100
  Re: Truthiness Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-10-23 16:47 +0200
    Re: Truthiness Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-10-23 17:01 +0200
    Re: Truthiness Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 16:07 +0000
  Re: Truthiness Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-10-23 16:49 +0200
  Re: Truthiness Skip Montanaro <skip.montanaro@gmail.com> - 2014-10-23 09:51 -0500
  Re: Truthiness Simon Kennedy <sffjunkie@gmail.com> - 2014-10-23 07:56 -0700
    Re: Truthiness random832@fastmail.us - 2014-10-23 11:24 -0400

csiph-web