Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79530
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!takemy.news.telefonica.de!telefonica.de!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'example:': 0.03; 'else:': 0.03; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'boolean': 0.16; 'interest,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'true:': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'academic': 0.26; 'somewhere': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'statement': 0.30; '>>>>': 0.31; 'context.': 0.31; 'received:132': 0.31; 'url:python': 0.33; 'but': 0.35; 'there': 0.35; 'false': 0.36; 'i.e.': 0.36; 'opposed': 0.36; 'url:org': 0.36; 'example,': 0.37; 'url:library': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'url:3': 0.61; 'first': 0.61; 'here': 0.66; 'kennedy': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> |
| Subject | Re: Truthiness |
| Date | Thu, 23 Oct 2014 16:49:05 +0200 |
| References | <61f0b04c-b827-4c03-b55d-4d5bd85b56f6@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | px1.ruf.uni-freiburg.de |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
| In-Reply-To | <61f0b04c-b827-4c03-b55d-4d5bd85b56f6@googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15111.1414075725.18130.python-list@python.org> (permalink) |
| Lines | 44 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1414075725 news.xs4all.nl 2916 [2001:888:2000:d::a6]:54619 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:79530 |
Show key headers only | View raw
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/stdtypes.html#comparisons
>>>> if 3:
> print("It's Twue")
>
> It's Twue
>
> i.e. in the if statement 3 is True but not in the first
>
Here is the misunderstanding: it is not true that 3 is True in the if
example, but it's evaluated as True in a boolean context. Illustration:
>>> 3 == True
False
>>> bool(3) == True
True
>>> bool(3) is True
True
If you combine if and a comparison, it behaves like in your first example:
>>>
if 3 == True:
print('True')
else:
print('False')
False
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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