Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Chase Newsgroups: comp.lang.python Subject: Re: Useless expressions [was Re: Undefined behaviour in C] Date: Sun, 27 Mar 2016 21:59:11 -0500 Lines: 24 Message-ID: References: <56f42d9f$0$1618$c3e8da3$5496439d@news.astraweb.com> <56f55e2e$0$1619$c3e8da3$5496439d@news.astraweb.com> <87wpoq1omm.fsf@elektro.pacujo.net> <56f5f81d$0$1585$c3e8da3$5496439d@news.astraweb.com> <87io0a6j1w.fsf@nightsong.com> <56f67ee3$0$1583$c3e8da3$5496439d@news.astraweb.com> <87poug5t0c.fsf@nightsong.com> <56f887c1$0$1598$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de FFsy8pdA529qXqHp83E08wBNLUmHqqvQPuCUEkYvUQ3Q== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'operator': 0.03; 'compiler': 0.05; 'discard': 0.05; 'thread': 0.10; '-tkc': 0.16; '12:38,': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'imo,': 0.16; 'pipes': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:expressions': 0.16; 'things"': 0.16; 'wrote:': 0.16; 'result,': 0.18; 'leave': 0.23; 'header:In- Reply-To:1': 0.24; 'sort': 0.25; 'chris': 0.26; 'said,': 0.27; 'subject: [': 0.29; "i'm": 0.30; 'that.': 0.30; 'code': 0.30; "i'd": 0.31; "can't": 0.32; 'steven': 0.33; 'though.': 0.33; 'gets': 0.35; 'generic': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'two': 0.37; 'charset:us-ascii': 0.37; 'things': 0.38; 'several': 0.38; 'to:addr:python.org': 0.40; 'where': 0.40; 'still': 0.40; 'different': 0.63; 'received:46': 0.63; 'done:': 0.84; 'dsl': 0.84; 'syntax;': 0.84; 'drops': 0.91; 'poorly': 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: 1459134148398:3518601977 X-MC-Ingress-Time: 1459134148398 In-Reply-To: X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) X-AuthUser: tim@thechases.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105892 On 2016-03-28 12:38, Chris Angelico wrote: > I would still look askance at code that adds two things and drops > the result, though. The compiler can't discard it, but if a linter > complains, I'd support that. A DSL that requires you to do this is, > imo, poorly designed. Is it only the "*add* two things" or are you decrying any generic operator that gets evaluated and then drops the result? Steven recently opened a thread ["Bash-like pipes in Python"] where this exact sort of thing would be done: get_values() | filter("smith") | sort("income") | send_to_printer() Several different solutions were posited with varying degrees of conciseness-vs-pythonicity-vs-pipe'ness. That said, I'm in the "let the compiler accept valid syntax; leave it to the linter" camp. -tkc