Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #101337
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: True/False value testing |
| Date | Thu, 7 Jan 2016 23:38:16 +1100 |
| Lines | 30 |
| Message-ID | <mailman.45.1452170304.2305.python-list@python.org> (permalink) |
| References | <568e3fb4$0$659$426a74cc@news.free.fr> <mailman.43.1452163794.2305.python-list@python.org> <877fjl7i30.fsf@elektro.pacujo.net> <mailman.44.1452167431.2305.python-list@python.org> <871t9t7fup.fsf@elektro.pacujo.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de X40TbTOuXOHart4LewCslwkRVoJbSbRYA3q8Nuu+b/dQ== |
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'builtin': 0.07; 'false.': 0.07; 'cc:addr:python-list': 0.09; 'operator,': 0.09; 'subclass': 0.09; 'jan': 0.11; 'argument': 0.15; 'thu,': 0.15; 'value.': 0.15; '"is"': 0.16; '2016': 0.16; 'constants': 0.16; 'evaluates': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'massively': 0.16; 'numpy': 0.16; 'received:209.85.223.173': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wording': 0.16; 'wrote:': 0.16; 'basically': 0.18; 'switched': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'explicit': 0.22; 'references': 0.23; 'second': 0.24; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'point.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'comparison': 0.29; 'operators': 0.29; 'raise': 0.29; 'subject:/': 0.30; 'classes': 0.30; 'error.': 0.31; 'generally': 0.32; 'url:python': 0.33; 'instances': 0.33; 'true.': 0.33; 'definition': 0.34; 'received:google.com': 0.35; 'done': 0.35; 'false': 0.35; 'but': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'url:library': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'stuff': 0.38; 'anything': 0.38; 'skip:e 20': 0.39; 'url:3': 0.60; 'skip:n 10': 0.62; 'more': 0.63; 'great': 0.63; '11:07': 0.84; 'actually,': 0.84; 'chrisa': 0.84; 'subject:value': 0.84; 'to:none': 0.91; 'subject:True': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=I91RYXOlfmghVcSUQo+6FttOEycCGS6u5SGfrHzISU8=; b=Qte1EJB49uS7GleQfOChNsoGQkgyC4+ne5RydYge7MruzdmoLN1XrYTHn68msiZqpe VeiEY/STXe03Pl0tPt9XN+eRYrLUmF4IRvEVCH/5Z6J0eHhfVhG1okSBpXaUHA601al3 xhmspaaiwFQtnuM15nzyMS0JmMWOFusYUZgDCH78V8kVT4bwBzcFeKUxSD8Y3tjaMahX VpKpTSVsI4vYv72balqxIIUjLXTbcva3KbAtPpr4ICoXJv/yl97ezML5eXcgRmI6MP5h tyNKlUHI1WlPe5r7vxaLWwgND5NKRCOTAJhKZe5BtPoF6o454Txo5MQYL16VeynA9Y3p RsZw== |
| X-Received | by 10.107.47.162 with SMTP id v34mr46303902iov.19.1452170296166; Thu, 07 Jan 2016 04:38:16 -0800 (PST) |
| In-Reply-To | <871t9t7fup.fsf@elektro.pacujo.net> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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> |
| Xref | csiph.com comp.lang.python:101337 |
Show key headers only | View raw
On Thu, Jan 7, 2016 at 11:07 PM, Marko Rauhamaa <marko@pacujo.net> wrote: > However, I *could* find this statement: > > 1. [or] is a short-circuit operator, so it only evaluates the second > argument if the first one is False. > > 2. [and] is a short-circuit operator, so it only evaluates the second > argument if the first one is True. > > <URL: https://docs.python.org/3/library/stdtypes.html#boolean-op > erations-and-or-not> > > The wording is very unfortunate (both the use of the word "is" and the > explicit references to the builtin constants False and True). Actually, that's a good point. I would call that a docs error. The definition of the comparison operators is, more or less: 1) Call a.__lt__(b). If it doesn't return NotImplemented, that's the value. 2) Call b.__gt__(a). If it doesn't return NotImplemented, that's the value. 3) Raise TypeError. Massively simplified; steps 1 and 2 get switched around if b is a subclass of a, and there's stuff about slots, and so on. But that's basically it. The function is allowed to return anything it likes. The built-in types generally return instances of bool, but custom classes are free to generalize (as numpy has done to great effect). ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
True/False value testing "ast" <nomail@invalid.com> - 2016-01-07 11:36 +0100
Re: True/False value testing Peter Otten <__peter__@web.de> - 2016-01-07 11:48 +0100
Re: True/False value testing Chris Angelico <rosuav@gmail.com> - 2016-01-07 21:49 +1100
Re: True/False value testing Marko Rauhamaa <marko@pacujo.net> - 2016-01-07 13:19 +0200
Re: True/False value testing Chris Angelico <rosuav@gmail.com> - 2016-01-07 22:50 +1100
Re: True/False value testing Marko Rauhamaa <marko@pacujo.net> - 2016-01-07 14:07 +0200
Re: True/False value testing Chris Angelico <rosuav@gmail.com> - 2016-01-07 23:38 +1100
Re: True/False value testing "ast" <nomail@invalid.com> - 2016-01-07 12:11 +0100
csiph-web