Path: csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: 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; 'true,': 0.04; 'cc:addr :python-list': 0.09; '"if': 0.09; '(1,': 0.09; 'imho.': 0.09; 'unpack': 0.09; '"in"': 0.16; '(3,': 0.16; '-tkc': 0.16; '2),': 0.16; 'chained': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'mean,': 0.16; 'really?': 0.16; 'sense,': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'suppose': 0.22; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'example': 0.26; 'skip:g 30': 0.30; "i'd": 0.31; 'useful': 0.33; 'could': 0.35; 'something': 0.35; 'but': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'really': 0.37; 'charset :us-ascii': 0.37; 'where': 0.40; 'ever': 0.60; "they're": 0.66; 'horrible': 0.84; 'received:162.253': 0.84; 'to:none': 0.91; 'technically': 0.91; 'subject:True': 0.93 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1442414374118:2792117887 X-MC-Ingress-Time: 1442414374117 Date: Wed, 16 Sep 2015 09:38:51 -0500 From: Tim Chase Cc: python-list@python.org Subject: Re: True == 1 weirdness In-Reply-To: <1442412230.1762717.385286049.20841F36@webmail.messagingengine.com> References: <0b949fe0-09b4-46b0-b4ac-a85a9bfebfd5@googlegroups.com> <1442412230.1762717.385286049.20841F36@webmail.messagingengine.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1442414387 news.xs4all.nl 23853 [2001:888:2000:d::a6]:41651 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96682 On 2015-09-16 10:03, Random832 wrote: > Do chained "in" comparisons ever really make sense, even when > they're all the same type? > > I mean, I suppose 1 in (1, 2) in ((1, 2), (3, 4)) is technically > true, but how useful is it really? I could concoct a "useful" example where "in" is involved in a chain, something like set_of_valid_ids = generate_valid_ids_maybe_negative() if 0 < i in set_of_valid_ids: do_something(i) This would unpack as "if 0 > i and i in set_of_valid_ids". However the "useful"ness of it doesn't outweigh the horrible readability IMHO. So I'd never actually *use* this, even if it might be "useful". -tkc