X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109 Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!nospam.fr.eu.org!usenet-fr.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(python': 0.05; 'append': 0.09; 'list)': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'angelico': 0.16; 'elsewhere,': 0.16; 'finney': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:behavior': 0.16; 'subject:list': 0.19; 'uncle': 0.19; 'header:In-Reply-To:1': 0.21; 'variable': 0.21; 'thu,': 0.22; 'joining': 0.23; 'received:209.85.210.174': 0.23; 'received:mail- iy0-f174.google.com': 0.23; '(or': 0.24; 'creating': 0.24; 'point,': 0.25; '(in': 0.26; 'message-id:@mail.gmail.com': 0.28; 'answered': 0.29; 'lists': 0.29; 'class': 0.29; 'confusion': 0.30; 'to:addr:python-list': 0.33; 'generally': 0.33; 'list': 0.33; 'list.': 0.33; 'chris': 0.34; 'actual': 0.36; 'lists,': 0.36; 'received:google.com': 0.37; 'something': 0.37; 'received:209.85': 0.37; 'playing': 0.37; 'two': 0.37; 'but': 0.38; 'question,': 0.38; 'subject:: ': 0.38; 'called': 0.39; 'received:209': 0.39; 'list,': 0.39; 'add': 0.39; 'to:addr:python.org': 0.39; 'following:': 0.40; 'plain': 0.40; '26,': 0.67; 'saving': 0.74; '3.1,': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=GbJKqX3rIA5Q0JXF6T2lVG+9SysZSAqNK/yJ+6GzWV4=; b=Gv6ZdT1vZSTl22T8vW8Sz15YJ+pI1VMGEWTewfbwUv8txlPkWgeBrfjW4u650JXxZ6 6R9FwFSMQE+YeDJKY0X0rmau7N90rFkxiijcICSqNK/YO1MOk4xcMQeayD4sYbvDNfj4 mi+suYtYzQRItctlyN2lKtAHgA1HFxpP7ttSo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=AvRmvBfrPQlpO3MNO5kap54mjI9FL62+Yr54+DVpsZ+vN6ffvyvLDkt0oYU0XMuEld CeRrSCw7dr9ySoYW3TlS+7zMVYlwtdIuSR9S5FeWU4DSRx7JFb9PqK3JIDZ0Qvfc/9WF fHNt0BkwSik+lFJvQvcOalOu+ju5rX//AgB/Q= MIME-Version: 1.0 In-Reply-To: <16c21256-48df-416a-971f-de49ca4cc981@x6g2000yqj.googlegroups.com> References: <16c21256-48df-416a-971f-de49ca4cc981@x6g2000yqj.googlegroups.com> Date: Thu, 26 May 2011 17:20:53 +1000 Subject: Re: Puzzled by list-appending behavior From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306394456 news.xs4all.nl 49180 [::ffff:82.94.164.166]:60130 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6300 On Thu, May 26, 2011 at 2:46 PM, Uncle Ben wrote: > In playing with lists of lists, I found the following: > > (In 3.1, but the same happens also in 2.7) > > list = [1,2,3] Ben Finney has already answered the main question, but as a side point, I would generally avoid creating a variable called 'list'. That's the name of the type (Python 2) or class (Python 3) of all lists, so it might result in confusion if you have an actual list with that name. If you want the behaviour of joining two lists (or adding something to a list) and saving the result elsewhere, you can use the plain addition: a=[1,2,3] b=a+[[4,5,6]] Note that you have to add a list, and it will append the contents of that list. Chris Angelico