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


Groups > comp.lang.python > #79815

Re: A bug?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!diablo1.news.osn.de!news.osn.de!diablo2.news.osn.de!news.tele.dk!news.tele.dk!small.news.tele.dk!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.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'skip:[ 20': 0.04; 'subject:bug': 0.07; 'cc:addr:python-list': 0.11; '3],': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'generally': 0.29; 'message-id:@mail.gmail.com': 0.30; '(which': 0.31; '>>>>': 0.31; 'received:google.com': 0.35; 'surely': 0.36; 'subject:?': 0.36; 'should': 0.36; 'being': 0.38; 'skip:[ 10': 0.38; 'pm,': 0.38; 'anything': 0.39; 'more': 0.64; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=56Z6u/gJuGUT1VR/LDHGAX39D0UrcWe5x8wnmDxuRzo=; b=Ukt8kPb3WL84WcE/0L1dT7NZxaHX4+wq5a0NO3GyhpHE3qxImWqZ76OW3tgIrMb+Hh thfy5FRVsw9F7Cx1CqjP7rtUdXgA1HCZZH0pdaukiQQVLtqywBncAbmxm97d6N3SM9V+ JgfYaA21b5gGZcdhCqoeo8YvqUGONpGlpciWE6oe4TpCe7YYYpDUvDIm0LF4hbr6Fwju 7bZZDKJWatip9nRfL7Ue9jBvyGN1j+NPfrJ7CvQU8hp13gWxvEX5NvzSBpxO7KcB9qxs DV7qDACHr1p0DeM/f9Ry3S5YpexTYOYj8PiOSx03o5aBZNaV4StaSLhU7O73XcKbSk2q zIww==
MIME-Version 1.0
X-Received by 10.42.188.77 with SMTP id cz13mr781965icb.19.1414459547196; Mon, 27 Oct 2014 18:25:47 -0700 (PDT)
In-Reply-To <b675d41f-b690-4bcc-a0b7-3310f61f39ce@googlegroups.com>
References <f491d969-7405-4017-b9c4-e1cb52a70280@googlegroups.com> <m2mof5$hvh$2@dont-email.me> <b675d41f-b690-4bcc-a0b7-3310f61f39ce@googlegroups.com>
Date Tue, 28 Oct 2014 12:25:47 +1100
Subject Re: A bug?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.15247.1414459556.18130.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1414459556 news.xs4all.nl 2839 [2001:888:2000:d::a6]:53609
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:79815

Show key headers only | View raw


On Tue, Oct 28, 2014 at 12:12 PM, Rustom Mody <rustompmody@gmail.com> wrote:
> More generally for d being a 2-D reshape of dd (which may be anything
> as long as the size matches)
>
>>>> dd = [1,2,3,4,5,6,7,8,9,10,11,12]
>>>> d=[[dd[i*3+j] for j in range(3)] for i in range(4)]
>>>> d
> [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]

The inner comprehension should surely be a slice:

>>> [dd[i*3:i*3+3] for i in range(4)]
[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]

ChrisA

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


Thread

A bug? "umatrp@gmail.com" <trsexgl@gmail.com> - 2014-10-27 09:01 -0700
  Re: A bug? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-10-27 17:17 +0100
  Re: A bug? Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-27 10:26 -0600
  Re: A bug? Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-28 00:36 +0000
    Re: A bug? Rustom Mody <rustompmody@gmail.com> - 2014-10-27 18:12 -0700
      Re: A bug? Chris Angelico <rosuav@gmail.com> - 2014-10-28 12:25 +1100
        Re: A bug? Rustom Mody <rustompmody@gmail.com> - 2014-10-27 19:13 -0700
    Re: A bug? Joshua Landau <joshua@landau.ws> - 2014-10-28 01:29 +0000
      Re: A bug? Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-29 02:17 +0000
        What for -- for?  (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-28 20:22 -0700
          Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-28 23:16 -0500
          Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-28 23:23 -0500
            Re: What for -- for? (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-28 21:40 -0700
              Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-28 23:59 -0500
                Re: What for -- for? (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-28 22:15 -0700
                Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-29 00:39 -0500
                Re: What for -- for? (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-28 23:11 -0700
                Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-29 01:18 -0500
                Finding way around ABCs (was What for -- for? (was A bug?)) Rustom Mody <rustompmody@gmail.com> - 2014-10-30 10:01 -0700
                Re: Finding way around ABCs (was What for -- for? (was A bug?)) Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-30 11:09 -0600
                Re: Finding way around ABCs (was What for -- for? (was A bug?)) Rustom Mody <rustompmody@gmail.com> - 2014-10-30 10:16 -0700
                Re: Finding way around ABCs (was What for -- for? (was A bug?)) Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-30 11:11 -0600
          Re: What for -- for? (was A bug?) Ben Finney <ben+python@benfinney.id.au> - 2014-10-29 16:27 +1100
          Re: What for -- for? (was A bug?) Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-10-29 00:42 -0500
            Re: What for -- for? (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-28 22:57 -0700
          Re: What for -- for? (was A bug?) Ben Finney <ben+python@benfinney.id.au> - 2014-10-29 17:02 +1100
          Re: What for -- for? (was A bug?) Joshua Landau <joshua@landau.ws> - 2014-10-30 17:21 +0000
            Re: What for -- for? (was A bug?) Rustom Mody <rustompmody@gmail.com> - 2014-10-30 10:41 -0700

csiph-web