Path: csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '16,': 0.03; '22,': 0.09; 'received:209.85.219': 0.09; 'python': 0.11; '2.7.3': 0.16; '23,': 0.16; '24,': 0.16; '32,': 0.16; '33,': 0.16; 'thanks,': 0.17; '>>>': 0.22; '>>>': 0.24; '31,': 0.24; '15,': 0.26; 'code:': 0.26; 'tried': 0.27; 'list:': 0.30; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; '25,': 0.31; 'received:209.85': 0.35; 'received:google.com': 0.35; 'received:209': 0.37; 'expected': 0.38; 'to:addr:python-list': 0.38; '12,': 0.39; 'to:addr:python.org': 0.39; '30,': 0.65; '26,': 0.68 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=ZOWLat+NY6L0vtl4DUN+OvIboi/7XB2uk5FWaxWpcPU=; b=ZJL8Hd7GePJYbSsWT5v78adxH1gQ1rJnLzIXm5PHdMzF0EMRfTY1s5fyRTCb4te22A DliNdak4XWyL2ovoJeWnUTPip4Vh2MzMa/7hvLZJY9EXjUGUwz0eXCijvWVX3QrHisic qa08EsDrkBEPW85e67QyYE7XTGGL+k19bL4Bgv/M/yoa6G1Srn/21edOreEKGVsPCJzU KTuJjxoTU+SvYaQgIBGCWMkqyDHO4UdtUbpqQemFRdSdAC4Vmw2egUHU414gBS7XLHEG 38LHNDA03DsZgUiA3qjCL7K7soQj4KyFRmabU+OjZ0UcrJW3LlWa2IrBm4Zxofg3rq4m GT+A== MIME-Version: 1.0 X-Received: by 10.182.226.162 with SMTP id rt2mr1512975obc.9.1366317318914; Thu, 18 Apr 2013 13:35:18 -0700 (PDT) Date: Thu, 18 Apr 2013 14:35:18 -0600 Subject: Strange behavior for a 2D list From: "Robrecht W. Uyttenhove" To: python-list@python.org Content-Type: multipart/alternative; boundary=001a11c2e93c7214b404daa88a39 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1366317327 news.xs4all.nl 2283 [2001:888:2000:d::a6]:40115 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43858 --001a11c2e93c7214b404daa88a39 Content-Type: text/plain; charset=ISO-8859-1 Hello, I tried out the following code: y=[range(0,7),range(7,14),range(14,21),range(21,28),range(28,35)] >>> y [[0, 1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12, 13], [14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27], [28, 29, 30, 31, 32, 33, 34]] >>> y[1:5:2][::3] [[7, 8, 9, 10, 11, 12, 13]] I expected the 2D list: [[ 7, 10, 13], [21, 24, 27]] Any ideas? Thanks, Rob PS: I used Python 2.7.3 --001a11c2e93c7214b404daa88a39 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello,

I tried out t= he following code:
y=3D[range(0,7),range(7,14),range(14,21),range(21,28)= ,range(28,35)]
>>> y
[[0, 1, 2, 3, 4, 5, 6],
=A0[7, 8, 9= , 10, 11, 12, 13],
=A0[14, 15, 16, 17, 18, 19, 20],
=A0[21, 22, 23, 24, 25, 26, 27],
= =A0[28, 29, 30, 31, 32, 33, 34]]

>>> y[1:5:2][::3]
[[7, = 8, 9, 10, 11, 12, 13]]

I expected the 2D list:
[[ 7, 10, 13= ],
=A0[21, 24, 27]]

Any ideas?

Thank= s,

Rob

PS: I used Python 2.7.3
--001a11c2e93c7214b404daa88a39--