Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66667
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!newsfeed0.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <johnmohagan@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'url:pipermail': 0.05; 'assignment': 0.07; 'wang': 0.07; '[1]:': 0.09; '[2]:': 0.09; '[3]:': 0.09; 'exception.': 0.09; 'subject:question': 0.10; 'thread': 0.14; '[4]:': 0.16; '[])': 0.16; 'bug,': 0.16; 'last)': 0.16; 'situation.': 0.16; 'typeerror:': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'thanks.': 0.20; '>>>': 0.22; 'error': 0.23; 'mon,': 0.24; 'this:': 0.26; 'header :In-Reply-To:1': 0.27; '[1]': 0.29; 'dec': 0.30; 'subject:list': 0.30; '"",': 0.31; 'changed.': 0.31; 'anyone': 0.31; 'file': 0.32; 'url:python': 0.33; '(most': 0.33; 'ago': 0.33; 'sense': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'two': 0.37; 'depends': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'explain': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'john': 0.61; 'name': 0.63; 'received:122': 0.63; 'deals': 0.65; 'below:': 0.68; '+0800': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=0XwSK2IIwNXNmU0g9hONyl65YRXU2suCepRcacNkqhg=; b=tDcASAnWaJ94w0dIkbvHbJKK3J71Gq/F6/dxtquf1jQf4sR6+zfj2n6Dzjaof4/9aH Of7XExFKGdxcOitZXG2yJ92fPQRxs+UBkf7lmw66zUrs18EI5GoQfz1669QeAo8DGynJ hEB6ciOAhJi7qfk0K1kvJUz3uIP/3vw+eitExPIle2U/keyrKPf4DrPrrwN8z9jdbytT Amg8vlIGT1eosDBhR5zett7fPSIxomBvGz1YtnsdgvXczkEut78J4TopTGVhKCTJWQx2 7TfmxpRzqxD3NFvEJYtBxjQSzAASWETX9yfyLIJ2F4ucwZNYHjCHQ5V7D4yf0jM99AyT UO9w== |
| X-Received | by 10.66.161.38 with SMTP id xp6mr362254pab.145.1392794073768; Tue, 18 Feb 2014 23:14:33 -0800 (PST) |
| Sender | "John O'Hagan" <johnmohagan@gmail.com> |
| Date | Wed, 19 Feb 2014 18:14:25 +1100 |
| From | John O'Hagan <research@johnohagan.com> |
| To | python-list@python.org |
| Subject | Re: a question about list as an element in a tuple |
| In-Reply-To | <CAFysF+SirN1VKMhCcuWjLXkK--+V2Bxs4AbntJgTjcMDMhrWuA@mail.gmail.com> |
| References | <CAFysF+SirN1VKMhCcuWjLXkK--+V2Bxs4AbntJgTjcMDMhrWuA@mail.gmail.com> |
| X-Mailer | Claws Mail 3.9.3 (GTK+ 2.24.22; x86_64-pc-linux-gnu) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| 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.7137.1392794077.18130.python-list@python.org> (permalink) |
| Lines | 55 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1392794077 news.xs4all.nl 2924 [2001:888:2000:d::a6]:43442 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:66667 |
Show key headers only | View raw
On Mon, 16 Dec 2013 11:30:13 +0800 liuerfire Wang <liuerfire@gmail.com> wrote: > Just like below: > > In [1]: a = ([], []) > > In [2]: a[0].append(1) > > In [3]: a > Out[3]: ([1], []) > > In [4]: a[0] += [1] > --------------------------------------------------------------------------- > TypeError Traceback (most recent call > last) <ipython-input-4-ea29ca190a4d> in <module>() > ----> 1 a[0] += [1] > > TypeError: 'tuple' object does not support item assignment > > In [5]: a > Out[5]: ([1, 1], []) > > no problem, there is an exception. But a is still changed. > > is this a bug, or could anyone explain it? > > thanks. > This thread from two years ago deals with this in some detail: https://mail.python.org/pipermail/python-list/2012-February/619265.html It's one of those things that is hard to resolve in a way that makes sense in every situation. The weirdest part for me is this: >>> t = ([],) >>> l = t[0] >>> l is t[0] True >>> l += [1] >>> t[0] += [1] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'tuple' object does not support item assignment Whether there is an error or not depends on the name used for the object! -- John
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: a question about list as an element in a tuple John O'Hagan <research@johnohagan.com> - 2014-02-19 18:14 +1100
Re: a question about list as an element in a tuple Marko Rauhamaa <marko@pacujo.net> - 2014-02-19 10:51 +0200
Re: a question about list as an element in a tuple Marko Rauhamaa <marko@pacujo.net> - 2014-02-19 10:54 +0200
csiph-web