Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73899

Re: TypeError expected in an augmented assignment

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.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.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; '"""': 0.07; 'assignment': 0.07; 'binary': 0.07; 'modified': 0.07; '[1,': 0.09; 'assigning': 0.09; 'augmented': 0.09; 'lawrence': 0.09; 'performs': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'satisfy': 0.09; 'similar,': 0.09; 'target,': 0.09; 'bug': 0.12; 'language.': 0.14; '"an': 0.16; '3],': 0.16; 'conformance': 0.16; 'effect.': 0.16; 'in-place,': 0.16; 'once.': 0.16; 'ought': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'rewritten': 0.16; 'wording': 0.16; 'attach': 0.16; 'language': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'possible,': 0.19; 'manual': 0.22; 'creating': 0.23; 'header :User-Agent:1': 0.23; 'instead.': 0.24; '---': 0.24; 'references': 0.26; 'suggested': 0.26; 'tracker': 0.26; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'patch': 0.29; 'raise': 0.29; 'doc': 0.31; 'actual': 0.34; 'equal': 0.35; 'but': 0.35; 'there': 0.35; 'two': 0.37; 'version,': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'rather': 0.38; 'quote': 0.39; 'to:addr:python.org': 0.39; 'changed': 0.39; 'either': 0.39; 'received:org': 0.40; 'expression': 0.60; 'free': 0.61; 'new': 0.61; 'viruses': 0.61; 'skip:* 10': 0.61; 'protection': 0.63; 'skip:n 10': 0.64; 'our': 0.64; 'email addr:python.org.': 0.66; 'here': 0.66; '>from': 0.68; 'antivirus': 0.68; 'link:': 0.72; 'behavior': 0.77; 'comparable': 0.84; 'object:': 0.84; 'significance': 0.84; 'yourself,': 0.95
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: TypeError expected in an augmented assignment
Date Thu, 03 Jul 2014 13:43:23 +0100
References <f1cd7efe-d628-4e96-9ed3-79d9a212f768@googlegroups.com> <mailman.11432.1404356297.18130.python-list@python.org> <55f74a23-95ea-4be1-950d-e57e645dab1a@googlegroups.com> <mailman.11446.1404376617.18130.python-list@python.org> <6ed679b1-c6e1-408e-8167-476b169fa2eb@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host host-92-18-5-57.as13285.net
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <6ed679b1-c6e1-408e-8167-476b169fa2eb@googlegroups.com>
X-Antivirus avast! (VPS 140703-0, 03/07/2014), Outbound message
X-Antivirus-Status Clean
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.11456.1404391406.18130.python-list@python.org> (permalink)
Lines 78
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1404391406 news.xs4all.nl 2883 [2001:888:2000:d::a6]:34645
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73899

Show key headers only | View raw


On 03/07/2014 10:35, candide wrote:
>
>
>> >From that link:
>>
>>
>>
>> """
>>
>> An augmented assignment expression like x += 1 can be rewritten as x =
>>
>> x + 1 to achieve a similar, but not exactly equal effect. In the
>>
>> augmented version, x is only evaluated once. Also, when possible, the
>>
>> actual operation is performed in-place, meaning that rather than
>>
>> creating a new object and assigning that to the target, the old object
>>
>> is modified instead.
>>
>> """
>>
>>
>>
>> The significance here is that the augmented assignment may not
>>
>> necessarily be at all comparable to the non-augmented version, but
>>
>> ought to have *approximately* the same *intention*.
>
>
> This is not my reading.
>
>
>
>
>>
>> of situations where the two will differ, eg when there are multiple
>>
>> references to the same object:
>>
>>
>>
>>>>> a = b = [1,2]
>>
>>>>> a += [3]
>>
>>>>> a,b
>>
>> ([1, 2, 3], [1, 2, 3])
>>
>>>>> a = a + [4]
>>
>>>>> a,b
>>
>> ([1, 2, 3, 4], [1, 2, 3])
>>
>>
>
> OK but this behavior is in conformance with the Reference Manual (cf. your quote above : "when possible, the actual operation is performed in-place"). This is not my point because the doc explictly claims that "an augmented assignment [...] performs the binary operation specific to the type of assignment on the two operands".
>

To get the wording changed to satisfy yourself, either raise an issue on 
the bug tracker at bugs.python.org and attach a patch file, or send an 
email with suggested wording to docs@python.org.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

TypeError expected in an augmented assignment candide <c.candide@laposte.net> - 2014-07-02 19:39 -0700
  Re: TypeError expected in an augmented assignment Terry Reedy <tjreedy@udel.edu> - 2014-07-02 22:57 -0400
    Re: TypeError expected in an augmented assignment candide <c.candide@laposte.net> - 2014-07-03 00:51 -0700
      Re: TypeError expected in an augmented assignment Chris Angelico <rosuav@gmail.com> - 2014-07-03 18:36 +1000
        Re: TypeError expected in an augmented assignment candide <c.candide@laposte.net> - 2014-07-03 02:35 -0700
          Re: TypeError expected in an augmented assignment Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-03 13:43 +0100

csiph-web