Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63263
| Path | csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'syntax': 0.04; 'guido': 0.05; 'binary': 0.07; 'python:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'similar,': 0.09; 'runs': 0.10; 'jan': 0.12; 'added.': 0.16; 'determines': 0.16; 'expression.': 0.16; 'notation,': 0.16; 'readability': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'ternary': 0.16; 'wrote:': 0.18; 'example': 0.22; 'header:User-Agent:1': 0.23; 'looks': 0.24; 'equivalent': 0.26; 'second': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'compared': 0.30; 'statement': 0.30; 'strongly': 0.30; 'code': 0.31; 'perl': 0.31; 'piece': 0.31; 'community': 0.33; 'knowledge': 0.35; 'there': 0.35; 'i.e.': 0.36; 'opposed': 0.36; 'hi,': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'negative': 0.60; 'break': 0.61; 'received:173': 0.61; 'first': 0.61; 'kind': 0.63; 'believe': 0.68; 'reverse': 0.68; 'statement,': 0.68; 'superior': 0.69; 'opinions': 0.70; 'lack': 0.78; 'received:fios.verizon.net': 0.84; 'not:': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: Postfix conditionals |
| Date | Sun, 05 Jan 2014 21:58:46 -0500 |
| References | <52C9BF95.5000006@gkayaalp.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | quoted-printable |
| X-Gmane-NNTP-Posting-Host | pool-173-75-254-207.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| In-Reply-To | <52C9BF95.5000006@gkayaalp.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5002.1388977145.18130.python-list@python.org> (permalink) |
| Lines | 45 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1388977145 news.xs4all.nl 2886 [2001:888:2000:d::a6]:41108 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:63263 |
Show key headers only | View raw
On 1/5/2014 3:24 PM, Göktuğ Kayaalp wrote:
> 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
'conditional expression', which happens to be a ternary as opposed to
binary expression.
> 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,
In general, negative on pure duplication. Guido has said he strongly
dislikes the perl reverse if.
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Postfix conditionals Terry Reedy <tjreedy@udel.edu> - 2014-01-05 21:58 -0500
csiph-web