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


Groups > comp.lang.python > #7568

Re: I want this to work. [[]] * n

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'operator': 0.05; 'am,': 0.14; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; 'wrote:': 0.14; '[[]': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mutability': 0.16; 'shallow': 0.16; 'verbose,': 0.16; 'tue,': 0.17; 'header:In-Reply-To:1': 0.21; 'message-id:@mail.gmail.com': 0.28; 'received:209.85.214': 0.28; 'lists': 0.29; 'bit': 0.30; 'but...': 0.30; 'anyone': 0.32; "can't": 0.32; 'does': 0.33; 'to:addr:python-list': 0.33; 'list': 0.33; 'lists,': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.37; 'page': 0.37; 'but': 0.38; 'subject:: ': 0.38; 'received:209': 0.39; 'either': 0.39; 'list,': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'subject:this': 0.76; 'different.': 0.84; 'subject:want': 0.93
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=oNaghGjRe1GxCzeGbA3cuBlNjqG+orVnDJVdQlsiJQo=; b=C42zy4mJYcqpllMLUFCV4q/CNvWw+OxePZ4W1lf3QfavdbG5ZHbrO8oSGLC5S2OR/o d9Hc5ZgNS/Ul8Y4iTak/5np7wySocPeiCZlaXGCR959wBRgFTYYnmLUAPK6LNTCBNBAF wifZ5fyqu0TjMb2Tl3CDznHjnylL5Wbsi0l74=
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=dk2RFmhuzd3EBfdRqHWQpnlZw8wtpqoKljE1OVXEa3/DRlnhx1q9xzZFThy9VlI87N isisbg4DM75PD18breBipFMKzZtYWGpokTpRmHNIDkgmk9s8FRDev+94j2w89NTzFAWu 3SQpclynk2NgHOp7BBq4jNOYvJ7ivkoDROXIo=
MIME-Version 1.0
In-Reply-To <45f5e602-b196-43b4-97cd-5fa8d4b7058c@h12g2000pro.googlegroups.com>
References <45f5e602-b196-43b4-97cd-5fa8d4b7058c@h12g2000pro.googlegroups.com>
Date Tue, 14 Jun 2011 08:51:38 +1000
Subject Re: I want this to work. [[]] * n
From Chris Angelico <rosuav@gmail.com>
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 <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>
Newsgroups comp.lang.python
Message-ID <mailman.201.1308005500.11593.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 82.94.164.166
X-Trace 1308005500 news.xs4all.nl 49046 [::ffff:82.94.164.166]:40765
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7568

Show key headers only | View raw


On Tue, Jun 14, 2011 at 8:37 AM, SherjilOzair <sherjilozair@gmail.com> wrote:
> I want a list which contains n lists, which are all different. I had
> read a page which was about the mutability of lists, and how the *
> operator on lists just does a shallow copy. But I can't find it now.
> Does anyone know of that page ?
>
> Either way, How to get a list of list, with all original lists ?

Bit more verbose, but...
[[] for i in range(n)]
is effective.

ChrisA

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


Thread

I want this to work. [[]] * n SherjilOzair <sherjilozair@gmail.com> - 2011-06-13 15:37 -0700
  Re: I want this to work. [[]] * n Chris Angelico <rosuav@gmail.com> - 2011-06-14 08:51 +1000
    Re: I want this to work. [[]] * n SherjilOzair <sherjilozair@gmail.com> - 2011-06-14 00:38 -0700

csiph-web