Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'encouraging': 0.07; 'tries': 0.07; 'string': 0.09; 'beginners': 0.09; 'considered.': 0.09; 'feature,': 0.09; 'interpreted': 0.09; 'python:': 0.09; 'statements': 0.09; 'runs': 0.10; 'cc:addr :python-list': 0.11; 'python': 0.11; 'wrote': 0.14; "'if',": 0.16; '(there': 0.16; 'blocks': 0.16; 'clunky': 0.16; 'denote': 0.16; 'determines': 0.16; 'dislike': 0.16; 'implemented,': 0.16; 'internally': 0.16; 'received:72.5': 0.16; 'received:72.5.230': 0.16; 'received:sender1.zohomail.com': 0.16; 'received:zohomail.com': 0.16; 'two.': 0.16; 'language': 0.16; '(not': 0.18; 'bit': 0.19; 'thoughts': 0.19; '(in': 0.22; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'skip:n 60': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'source': 0.25; 'developers': 0.25; 'equivalent': 0.26; 'switch': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'statement': 0.30; 'code': 0.31; 'getting': 0.31; 'constant': 0.31; 'indentation': 0.31; 'piece': 0.31; 'writes:': 0.31; 'regular': 0.32; 'community': 0.33; 'cases': 0.33; 'implemented': 0.33; 'actual': 0.34; 'device': 0.34; 'problem': 0.35; "can't": 0.35; 'but': 0.35; 'really': 0.36; 'i.e.': 0.36; 'useful': 0.36; 'easily': 0.37; 'being': 0.38; 'fact': 0.38; 'rather': 0.38; 'that,': 0.38; 'though,': 0.39; 'skip:u 10': 0.60; 'break': 0.61; 'length': 0.61; 'from:charset:utf-8': 0.61; 'name': 0.63; 'soon': 0.63; 'more': 0.64; 'love': 0.65; 'line,': 0.68; 'statement,': 0.68; 'attractive': 0.81; "'when'": 0.84; 'avoid.': 0.84; 'possible!': 0.84; 'not:': 0.91 From: =?utf-8?B?R8O2a3R1xJ8=?= Kayaalp To: "BartC" Subject: Re: Postfix conditionals References: <8SVHu.12417$MB1.2814@fx09.am4> Date: Tue, 04 Feb 2014 07:16:07 +0200 In-Reply-To: <8SVHu.12417$MB1.2814@fx09.am4> (BartC's message of "Mon, 3 Feb 2014 23:43:57 -0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-Zoho-Virus-Status: 2 Cc: python-list@python.org 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: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391490975 news.xs4all.nl 2836 [2001:888:2000:d::a6]:49872 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65404 [comments inline] "BartC" writes: > "G=C3=B6ktu=C4=9F Kayaalp" wrote in message > news:mailman.4966.1388953508.18130.python-list@python.org... > >> 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 > >> What are your thoughts on this? > > I develop my own language (not Python, but also dynamic and interpreted). Would love to see that, if possible! > I have this feature, and it's OK, but not indispensible. I varied it a b= it > by allowing 'if', 'when' and 'unless' as the conditionals, just to break = it > up a little. However, it just maps internally to a regular if-statement. > > In Python though, the normal way of writing 'break if not i' is about the > same length (in my language it's somewhat longer), so I can't see it gett= ing > much support. I do not really think that string length is not of much significance. The actual fact that disallows my proposal from being favoured/implemented is that in Python, `break', `return' and `continue' are statements and the community encourages having one statement per line, so that the source code is easily understandable. With my proposal implemented, the language would would be encouraging having multiple statements in one line, that looks like a single statement, but is indeed a composition of two. I rather dislike the statement-orientedness of Python, but still, it is a good device of easening for the language developers and beginners when the fact that we use indentation to denote blocks is considered. > What would be far more useful would be a proper 'switch' statement, but if > that's not in, then I don't think your proposal will get far! > > (There are various clunky workarounds for switch - one idea is to use an > if-elseif chain, but that's just what it tries to avoid. Switch is > attractive for an interpreted language because - provided all cases > are constants, a bit of a problem in Python, because as soon as you > give a name to something, it's no longer constant - it can be > implemented very efficiently.) > > --=20 > Bartc=20