Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107276
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: [Python-ideas] Changing the meaning of bool.__invert__ |
| Date | Mon, 18 Apr 2016 14:41:44 -0600 |
| Lines | 20 |
| Message-ID | <mailman.156.1461012147.6324.python-list@python.org> (permalink) |
| References | <570679AF.7020502@stoneleaf.us> <loom.20160407T175706-651@post.gmane.org> <57068A10.3020904@stoneleaf.us> <CAP7+vJKOXpFwM+=hcZ5V+XG0g6xhEMcLyhs03iH8ii3Ub6mFOQ@mail.gmail.com> <57069645.8040509@stoneleaf.us> <CAP7+vJL88wnao+yEY1esC0iZ6jv1s1HEiWW7uE8Nw3dQVBUvxw@mail.gmail.com> <CD6766B4-A14B-4AAC-9E79-F43367C9CCB0@selik.org> <CAP7+vJKgzA5=RgVkNBVyR8eMOhmxUmmh-uLdqHhzRLD-0-6S2A@mail.gmail.com> <20160408014030.GL12526@ando.pearwood.info> <22279.18221.103226.654215@turnbull.sk.tsukuba.ac.jp> <20160409154305.GU12526@ando.pearwood.info> <CABDEq2mUhLMo2o=HTyxpV=pbPazakHoO-8OjFBLeKVWoZZTz4w@mail.gmail.com> <CALwzidnogG3DvUi-eybcete+Zy9KwttyOAeUCyX1nS-m4LJ2kQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de 2KTM5GzmoLUjyQFs6IhFCQluXSj3VlXkHK2+VHvE6SDA== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.03; 'operator': 0.03; 'subject:Python': 0.05; 'subject:skip:b 10': 0.07; 'def': 0.13; '2016': 0.16; 'b):': 0.16; 'evaluates': 0.16; 'mistake.': 0.16; 'readable': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:ideas': 0.16; 'wrote:': 0.16; 'say,': 0.18; 'subject:] ': 0.19; 'suppose': 0.22; 'header:In- Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'looks': 0.29; 'argue': 0.29; 'that.': 0.30; 'useful': 0.33; "d'aprano": 0.33; 'shorter': 0.33; 'steven': 0.33; "i'll": 0.33; 'received:google.com': 0.35; 'could': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'received:209.85.213': 0.37; 'received:209': 0.38; 'does': 0.39; 'subject:the': 0.39; 'easily': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'avoid': 0.61; 'more': 0.63; "they're": 0.66; 'to:name:python': 0.84; 'evaluation.': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=GYWyhyGIQhCTPUA3oIdWZ2liipoMnGXg753T2uMbF70=; b=D9ixyRlNzIwWy2Z+qG/LOO7vYKXR/vp5vLLfc0Jq9xJ7LFf1e9GFMgq7wk0AHaS1zt PnbpJirSgSGr0F5PIVwu461bcWCbY6KSPs+JoBGfkwreCSU0FB+1nXzowlMhfFbBLDZT eWsaHjiGiiAr7hUoNifQxzkTJob3r72Ses03QdEXhOtCym+K40uIDEGcDWpgjkM+anGK lpPl5GlRtzG6nAUi3MQlxUTD+k7PBWOZfv/Jzw6UpN26r+sLg8nbmqkV4KF0ILYzd2oA 2Ig4fyfSIO1SLo57Kk9xMyhsjrpsMYuCd+rQS40lgNDMA48zTTB//tdYeCATrXKsESPM +vqw== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=GYWyhyGIQhCTPUA3oIdWZ2liipoMnGXg753T2uMbF70=; b=eCtmw8t0bL4y4T9yJaLytnE7zLE5UFvCVh3WXDpHjAZpah+LBCSKp/QlkK74Wh6Q49 +51xnw5ul4c0zXyGJezX7504jgfhlYCOZi6P4Kn8cszYQ9XFUEtpkcrtBR8TWbaLMU/c ve3wl2PrK1KiAUI/aPLNiSx7gEiKEQzukoTVf4gXkXStwt5FEuCyjeSEiODNFQwQJ+T8 JSTX2XOyuNwg8SUtqCcvY/lJoXpckpYNk6UXuVOwh9TyZO69Dx6+deDBz/7uOEmcpkiS 1Ij7FT5JPY6YIzZIFqeFH2+CjCpGquSsoExd9eV3RFhI+Zzxb7jG11ysgLcRXdE0OlRB 1eog== |
| X-Gm-Message-State | AOPr4FWkH/605R1bVufln4WAmyTsRCv7a43kLPknxIUhp+rYHDAQuexcXMSDC5+l8sDfb0O+xV8Ri78x4/C0iQ== |
| X-Received | by 10.50.57.50 with SMTP id f18mr21423824igq.93.1461012144596; Mon, 18 Apr 2016 13:42:24 -0700 (PDT) |
| In-Reply-To | <CABDEq2mUhLMo2o=HTyxpV=pbPazakHoO-8OjFBLeKVWoZZTz4w@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| 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> |
| X-Mailman-Original-Message-ID | <CALwzidnogG3DvUi-eybcete+Zy9KwttyOAeUCyX1nS-m4LJ2kQ@mail.gmail.com> |
| X-Mailman-Original-References | <570679AF.7020502@stoneleaf.us> <loom.20160407T175706-651@post.gmane.org> <57068A10.3020904@stoneleaf.us> <CAP7+vJKOXpFwM+=hcZ5V+XG0g6xhEMcLyhs03iH8ii3Ub6mFOQ@mail.gmail.com> <57069645.8040509@stoneleaf.us> <CAP7+vJL88wnao+yEY1esC0iZ6jv1s1HEiWW7uE8Nw3dQVBUvxw@mail.gmail.com> <CD6766B4-A14B-4AAC-9E79-F43367C9CCB0@selik.org> <CAP7+vJKgzA5=RgVkNBVyR8eMOhmxUmmh-uLdqHhzRLD-0-6S2A@mail.gmail.com> <20160408014030.GL12526@ando.pearwood.info> <22279.18221.103226.654215@turnbull.sk.tsukuba.ac.jp> <20160409154305.GU12526@ando.pearwood.info> <CABDEq2mUhLMo2o=HTyxpV=pbPazakHoO-8OjFBLeKVWoZZTz4w@mail.gmail.com> |
| Xref | csiph.com comp.lang.python:107276 |
Show key headers only | View raw
On Sun, Apr 17, 2016 at 12:24 PM, Pavol Lisy <pavol.lisy@gmail.com> wrote:
> 2016-04-09 17:43 GMT+02:00, Steven D'Aprano <steve@pearwood.info>:
>> flag ^ flag is useful since we don't have a boolean-xor operator and
>> bitwise-xor does the right thing for bools. And I suppose some people
>> might prefer & and | over boolean-and and boolean-or because they're
>> shorter and require less typing. I don't think that's a particularly
>> good reason for using them, and as you say, you do have to guard
>> against non-bools slipping, but Consenting Adults applies.
>
> They are also useful if you need to avoid short-circuit evaluation.
One can easily write functions to do that.
def long_or(a, b):
"""Equivalent to a or b but always evaluates both expressions."""
return a or b
long_or(a, b) may not be as pretty as a | b, but I'll argue that it's
more readable since it's up-front about its intent, whereas a | b
looks like it could just be a mistake.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: [Python-ideas] Changing the meaning of bool.__invert__ Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-18 14:41 -0600
csiph-web