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


Groups > comp.lang.python > #73885

Re: TypeError expected in an augmented assignment

X-Received by 10.66.165.165 with SMTP id yz5mr1660435pab.37.1404373900082; Thu, 03 Jul 2014 00:51:40 -0700 (PDT)
X-Received by 10.140.107.35 with SMTP id g32mr60167qgf.2.1404373899967; Thu, 03 Jul 2014 00:51:39 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!uq10no1134674igb.0!news-out.google.com!a8ni6410qaq.1!nntp.google.com!w8no5481128qac.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Thu, 3 Jul 2014 00:51:39 -0700 (PDT)
In-Reply-To <mailman.11432.1404356297.18130.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=82.245.68.143; posting-account=J_U-0woAAACrUCMCI_QdLAKny8A2zeDX
NNTP-Posting-Host 82.245.68.143
References <f1cd7efe-d628-4e96-9ed3-79d9a212f768@googlegroups.com> <mailman.11432.1404356297.18130.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <55f74a23-95ea-4be1-950d-e57e645dab1a@googlegroups.com> (permalink)
Subject Re: TypeError expected in an augmented assignment
From candide <c.candide@laposte.net>
Injection-Date Thu, 03 Jul 2014 07:51:40 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:73885

Show key headers only | View raw


>  >>> seq = [1,2]
> 
>  >>> seq.extend((3,4))


OK, this feature is referenced in the Python Library reference here : 

https://docs.python.org/3.2/library/stdtypes.html#typesseq-mutable

not thoroughly referenced but, anyway, referenced.





> 
>  >>> seq+= {5, 6}  # the order of extending is not determined
> 
>  >>> seq
> 
> [1, 2, 3, 4, 5, 6]
> 
>  >>>

Good and interesting observation. But I can't find out where this feature is referenced in the Language/Library Reference. Because, as my first post explains, augmented assignment performs the binary operation associated to the augmented assignment, cf. 

https://docs.python.org/3.2/reference/simple_stmts.html#augmented-assignment-statements

so seq+= {5, 6} performs seq + {5, 6}, the later raising a TypeError.

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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