Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100121
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: increment/decrement operators |
| Date | Mon, 7 Dec 2015 17:24:44 -0700 |
| Lines | 34 |
| Message-ID | <mailman.42.1449534294.12405.python-list@python.org> (permalink) |
| References | <dcg4apF3gq3U1@mid.individual.net> <n3umug$f0$1@news.albasani.net> <20151205094115.01751274@imp> <mailman.225.1449330245.14615.python-list@python.org> <n3v653$g0g$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de NmshbBQkU0Vff2C+JBCzXQvWJ15VfKRmOqe79B3Jr7tQ== |
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'received:209.85.223': 0.03; 'python)': 0.05; 'expressions': 0.07; 'commit': 0.15; 'value.': 0.15; '(unlike': 0.16; 'hard-code': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'statements,': 0.16; 'stepping': 0.16; 'subject:operators': 0.16; 'value;': 0.16; 'wrote:': 0.16; 'skip': 0.18; '>': 0.18; '2015': 0.20; 'either.': 0.22; 'latter': 0.22; 'am,': 0.23; 'dec': 0.23; 'unlike': 0.23; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; 'values': 0.28; 'them?': 0.29; 'subject:/': 0.30; 'that.': 0.30; "can't": 0.32; 'are:': 0.32; 'received:google.com': 0.35; 'next': 0.35; 'could': 0.35; 'something': 0.35; 'step': 0.36; 'but': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'received:209': 0.38; 'anything': 0.38; 'mean': 0.38; 'why': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'necessarily': 0.63; 'differences': 0.66; "they're": 0.66; 'syntax?': 0.84; 'to:name:python': 0.84; 'imagine': 0.96 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=0znkSI8CEAAWOw6qf0CQevXS8QjWKgWlBa/U7+mj2N0=; b=M7EGrnPfOr0cmeyqjaYFvSK40A42bFknubgAG1/THDyLAFs4hTEmbKBI/3dCT26wx+ BLhvYbADgbcUq0nkt2QjpoBQo5mkkfikfya0eI3q7i33WJ/Hqw19O+buDhXwxr1s5s0O 15/UOjH40UOG79ZQpuicMAv/prB1uKlJdyir1jdUTVATLvZfd4+qFRCdchMpoocD3gty TpwmaCpMuK1t3YCB76BkrE9ZQ+GAsq09E5jhFEczmld7YrfcVR1RWKE3L0glBIBsa4LU C0rfaOhM7SyZm09jGdvPH9PxYOBWNVJDARRZGOMTOl1jzYtxOTiWOpxxGYy2H68BBvcj 8Kfw== |
| X-Received | by 10.107.164.154 with SMTP id d26mr1180369ioj.111.1449534284889; Mon, 07 Dec 2015 16:24:44 -0800 (PST) |
| In-Reply-To | <n3v653$g0g$1@dont-email.me> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.20+ |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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> |
| Xref | csiph.com comp.lang.python:100121 |
Show key headers only | View raw
On Dec 5, 2015 10:21 AM, "BartC" <bc@freeuk.com> wrote: > > > The latter is not the same. Some of the differences are: > > * ++ and -- are often inside inside expressions and return values (unlike x+=1 in Python) > > * x++ and x-- return the /current/ value of x, unlike x+=1 even if it were to return a value; it would be the new value Since x+=1 is not an expression, this is moot. > * x+=1 requires you to hard-code the value 1, but ++ is not necessarily stepping by 1. You can imagine ++ stepping something to its next value. Note that x+=1 does not necessarily have to mean stepping by 1 either. You could even do something like x+=5 to mean skip the next four values and step x to the value after that. > However, if ++ and -- are only used as statements, then why not simply map them to x+=1? In Python, that would need to be x++ and x-- as ++x or --x have existing meanings. I think a better question is if they're only going to be statements, then why bother adding them? x++ doesn't give you anything you can't get from x+=1, so why commit to supporting the extra syntax?
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
increment/decrement operators Tony van der Hoff <tony@vanderhoff.org> - 2015-12-05 12:40 +0000
Re: increment/decrement operators Robin Koch <robin.koch@t-online.de> - 2015-12-05 13:56 +0100
Re: increment/decrement operators Tony van der Hoff <tony@vanderhoff.org> - 2015-12-05 14:14 +0000
Re: increment/decrement operators "D'Arcy J.M. Cain" <darcy@VybeNetworks.com> - 2015-12-05 09:41 -0500
Re: increment/decrement operators Terry Reedy <tjreedy@udel.edu> - 2015-12-05 10:43 -0500
Re: increment/decrement operators BartC <bc@freeuk.com> - 2015-12-05 17:18 +0000
Re: increment/decrement operators Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-07 17:24 -0700
csiph-web