Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19790
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed0.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <dihedral88888@googlemail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.017 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'assign': 0.04; 'instance,': 0.05; 'reply-to:addr:comp.lang.python': 0.09; 'statement.': 0.09; 'to:addr:comp.lang.python': 0.09; 'c++': 0.12; 'cc:addr:python-list': 0.15; '(besides': 0.16; 'allowed.': 0.16; 'modified.': 0.16; 'subject:copy': 0.16; 'wrote:': 0.16; 'instance': 0.18; 'modified': 0.18; 'cc:no real name:2**0': 0.21; 'discussion': 0.21; 'so.': 0.21; 'header:In-Reply-To:1': 0.22; 'obviously': 0.23; '(where': 0.23; 'object,': 0.24; 'cc:2**0': 0.25; 'performing': 0.25; 'pm,': 0.26; 'expressions': 0.28; 'problem': 0.29; 'cc:addr:python.org': 0.29; 'at.': 0.30; 'semantics': 0.30; 'thanks': 0.32; "can't": 0.32; 'header:User- Agent:1': 0.33; 'from:addr:googlemail.com': 0.34; 'operations': 0.34; 'combination': 0.36; 'two': 0.37; 'reference': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'getting': 0.37; 'received:209.85': 0.38; 'should': 0.38; 'either': 0.39; 'received:209': 0.39; 'subject:: ': 0.39; 'difference': 0.40; 'design': 0.61; 'your': 0.61; 'free': 0.63; 'behaviors': 0.67; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'stand': 0.72; 'reply-to:addr:googlegroups.com': 0.74; 'different.': 0.84; 'subject:write': 0.84; 'skip:2 50': 0.91 |
| Newsgroups | comp.lang.python |
| Date | Thu, 2 Feb 2012 05:33:17 -0800 (PST) |
| In-Reply-To | <mailman.4736.1326498530.27778.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=123.204.77.169; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw |
| References | <mailman.4709.1326455724.27778.python-list@python.org> <4f101f45$0$29999$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmr-069xisN6h4Cxt77vWbb+VhtMb-LRNfvyphwGz0C5GA@mail.gmail.com> <mailman.4714.1326462667.27778.python-list@python.org> <jephmt$hhp$1@reader1.panix.com> <mailman.4718.1326473361.27778.python-list@python.org> <9nb5ubFu17U2@mid.individual.net> <mailman.4728.1326486286.27778.python-list@python.org> <9nblhhFr5bU1@mid.individual.net> <mailman.4736.1326498530.27778.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| MIME-Version | 1.0 |
| Subject | Re: copy on write |
| From | 88888 Dihedral <dihedral88888@googlemail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | comp.lang.python@googlegroups.com |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Message-ID | <mailman.5356.1328189605.27778.python-list@python.org> (permalink) |
| Lines | 45 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1328189605 news.xs4all.nl 6881 [2001:888:2000:d::a6]:52639 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19790 |
Show key headers only | View raw
在 2012年1月14日星期六UTC+8上午6时48分29秒,Evan Driscoll写道: > On 01/13/2012 03:20 PM, Neil Cerutti wrote: > > They perform the same action, but their semantics are different. > > operator+ will always return a new object, thanks to its > > signature, and operator+= shall never do so. That's the main > > difference I was getting at. > > I was talking about the combination of + and =, since the discussion is > about 'a = a + b' vs 'a += b', not 'a + b' vs 'a += b' (where the > differences are obvious). > > And I stand by my statement. In 'a = a + b', operator+ obviously returns > a new object, but operator= should then go and assign the result to and > return a reference to 'a', just like how 'a += b' will return a > reference to 'a'. > The operation a+b means add(a,b) and returns a result instance, furthermore a and b can't be modified. The expression a = a+b are two operations not one. But in C or C++ the problem is mixing operations and expressions in a free style allowed. The operation a+=b means a modified by b and b can't be changed. Note that no new instance is necessary in a+=b. > If you're working in C++ and overload your operators so that 'a += b' > and 'a = a + b' have different observable behaviors (besides perhaps > time), then either your implementation is buggy or your design is very > bad-mannered. > > Evan Do you mean the result instances after 'a+=b' and 'a=a+b' or the actions of behaviors of instances involved in performing 'a+=b' and 'a=a+b'?
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
copy on write Eduardo Suarez-Santana <esuarez@itccanarias.org> - 2012-01-13 11:33 +0000
Re: copy on write Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-13 12:10 +0000
Re: copy on write Chris Angelico <rosuav@gmail.com> - 2012-01-13 23:30 +1100
Re: copy on write Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-13 13:04 +0000
Re: copy on write Ethan Furman <ethan@stoneleaf.us> - 2012-01-13 10:40 -0800
Re: copy on write 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-13 14:26 -0800
Re: copy on write 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-13 14:26 -0800
Re: copy on write John O'Hagan <research@johnohagan.com> - 2012-02-02 14:18 +1100
Re: copy on write Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-02 01:34 -0500
Re: copy on write John O'Hagan <research@johnohagan.com> - 2012-02-02 19:11 +1100
Re: copy on write Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-02 09:16 +0000
Re: copy on write Hrvoje Niksic <hniksic@xemacs.org> - 2012-02-02 11:53 +0100
Re: copy on write MRAB <python@mrabarnett.plus.com> - 2012-02-02 16:28 +0000
Re: copy on write Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-02 12:21 -0500
Re: copy on write John O'Hagan <research@johnohagan.com> - 2012-02-03 01:17 +1100
Re: copy on write Terry Reedy <tjreedy@udel.edu> - 2012-02-02 12:25 -0500
Re: copy on write John O'Hagan <research@johnohagan.com> - 2012-02-03 14:08 +1100
Re: copy on write Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-03 05:04 +0000
Re: copy on write Chris Angelico <rosuav@gmail.com> - 2012-02-03 16:28 +1100
Re: copy on write Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-03 07:35 -0800
Re: copy on write Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2012-02-03 10:08 +0100
Re: copy on write John O'Hagan <research@johnohagan.com> - 2012-02-03 21:47 +1100
Re: copy on write Wolfram Hinderer <wolfram.hinderer@googlemail.com> - 2012-02-05 06:09 -0800
Re: copy on write "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2012-02-03 16:15 +0000
Re: copy on write Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-02-02 11:42 +0100
Re: copy on write Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-13 08:50 -0500
Re: copy on write Grant Edwards <invalid@invalid.invalid> - 2012-01-13 15:13 +0000
Re: copy on write Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-13 11:48 -0500
Re: copy on write Neil Cerutti <neilc@norwich.edu> - 2012-01-13 16:54 +0000
Re: copy on write Grant Edwards <invalid@invalid.invalid> - 2012-01-13 18:15 +0000
Re: copy on write Chris Angelico <rosuav@gmail.com> - 2012-01-14 05:26 +1100
Re: copy on write Grant Edwards <invalid@invalid.invalid> - 2012-01-13 19:30 +0000
Re: copy on write Neil Cerutti <neilc@norwich.edu> - 2012-01-13 20:11 +0000
Re: copy on write Evan Driscoll <edriscoll@wisc.edu> - 2012-01-13 13:24 -0600
Re: copy on write Neil Cerutti <neilc@norwich.edu> - 2012-01-13 21:20 +0000
Re: copy on write Evan Driscoll <edriscoll@wisc.edu> - 2012-01-13 16:48 -0600
Re: copy on write 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-02 05:33 -0800
Re: copy on write Evan Driscoll <edriscoll@wisc.edu> - 2012-02-02 15:20 -0600
Re: copy on write 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-02 05:33 -0800
Re: copy on write 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-03 14:16 -0800
Re: copy on write 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-03 14:16 -0800
Re: copy on write Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-01 19:51 -0800
Re: copy on write Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-02 05:31 +0000
csiph-web