Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; 'syntax': 0.04; 'python:': 0.09; 'similar,': 0.09; 'runs': 0.10; 'added.': 0.16; 'determines': 0.16; 'notation,': 0.16; 'readability': 0.16; 'received:72.5': 0.16; 'received:72.5.230': 0.16; 'received:sender1.zohomail.com': 0.16; 'received:zohomail.com': 0.16; 'ternary': 0.16; 'thoughts': 0.19; 'example': 0.22; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'looks': 0.24; 'equivalent': 0.26; 'second': 0.26; 'compared': 0.30; 'statement': 0.30; 'code': 0.31; 'posting': 0.31; 'perl': 0.31; 'piece': 0.31; 'community': 0.33; 'knowledge': 0.35; 'there': 0.35; 'i.e.': 0.36; 'hi,': 0.36; 'two': 0.37; 'list.': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'break': 0.61; 'from:charset:utf-8': 0.61; 'first': 0.61; 'kind': 0.63; 'here': 0.66; 'believe': 0.68; 'statement,': 0.68; 'superior': 0.69; 'opinions': 0.70; 'lack': 0.78; 'not:': 0.91 Date: Sun, 05 Jan 2014 22:24:53 +0200 From: =?UTF-8?B?R8O2a3R1xJ8gS2F5YWFscA==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: python-list@python.org Subject: Postfix conditionals Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ZohoMailClient: External X-Zoho-Virus-Status: 2 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1388953508 news.xs4all.nl 2967 [2001:888:2000:d::a6]:35931 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63220 Hi, AFAIK, we do not have "postfix conditionals" in Python, i.e. a condition appended to a statement, which determines whether the statement runs or not: py> for i in [False]: ... break if not i The above piece of code is equivalent to this in Python: py> for i in [False]: ... if not i ... break I believe that the first example is superior to the second example when the two is compared for readability and intuitiveness. We already have a ternary statement that looks similar, py> print('hi') if True else None so I reckon there would be no breakage in old code if this kind of syntax was added. Ruby has this, and AFAIK Perl also does. I lack the knowledge of whether the community has opinions on this kind of notation, so I am posting this here instead of the ideas list. What are your thoughts on this? gk