Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!feeder.news-service.com!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.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:bug': 0.04; 'subject:Python': 0.06; 'url:faq': 0.09; 'wrote:': 0.15; 'columns': 0.16; 'received:209.85.213.174': 0.16; 'received:mail- yx0-f174.google.com': 0.16; 'cc:addr:python-list': 0.16; 'mon,': 0.16; 'pm,': 0.16; 'cheers,': 0.19; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'skip:[ 10': 0.26; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.30; 'chris': 0.32; 'defining': 0.35; 'david': 0.35; 'url:python': 0.37; 'faq:': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'url:docs': 0.39; 'received:209': 0.40; 'where': 0.40; '11,': 0.68; '10:39': 0.84; 'matrix': 0.84; 'sender:addr:chris': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=2V3NKZPB6h8etWirUthigEXu1EuU7lZccJU/dlbzeXM=; b=QSF0A1NUxe39vuHGKOr9jtvJ3pfeNMIo4i66VYnu0WAdxCfKM1Zm3aMdKQ6VZrU+2t C31nk13xfSGqICgC1LqQja1wxs8EgjOVQxjQu786zNvcYS1/GptJ74yjpDBXdl0LRRej W9b5YmGRRfJEBMGj6pFcvkh2XYoHwAzo/DUIc= MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: <394aae4f-92ac-406e-bd44-2d2bd3debd91@l1g2000yql.googlegroups.com> References: <394aae4f-92ac-406e-bd44-2d2bd3debd91@l1g2000yql.googlegroups.com> Date: Mon, 11 Jul 2011 22:44:05 -0700 X-Google-Sender-Auth: WsK9Xii2ejbeLdZPmOnTI2Som3Y Subject: Re: Python bug? Indexing to matrices From: Chris Rebert To: David Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310449448 news.xs4all.nl 21828 [2001:888:2000:d::a6]:58067 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9305 On Mon, Jul 11, 2011 at 10:39 PM, David wrote: > Should the following line work for defining a matrix with zeros? > > c= [[0]*col]*row > > where "col" is the number of columns in the matrix and "row" is of > course the number of rows. Nope. See the FAQ: http://docs.python.org/faq/programming.html#how-do-i-create-a-multidimensional-list Cheers, Chris