Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.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; 'cpython': 0.05; 'sized': 0.07; 'python': 0.09; 'subject:()': 0.09; '(the': 0.15; 'crashes': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'index.': 0.16; 'oct': 0.16; 'py_ssize_t': 0.16; 'subject:array': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'element': 0.17; 'integer': 0.17; 'variable': 0.20; 'received:209.85.214.174': 0.21; 'noted': 0.22; 'of.': 0.22; 'programming': 0.23; 'comment:': 0.23; 'elements': 0.23; 'signed': 0.24; 'least': 0.25; 'header:In-Reply- To:1': 0.25; 'guess': 0.27; 'andrew': 0.27; 'start,': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'omitted': 0.29; 'objects': 0.29; "i'm": 0.29; 'notes': 0.30; 'lists': 0.31; 'code': 0.31; 'explains': 0.33; 'ram': 0.33; 'stands': 0.33; 'values.': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'lists.': 0.35; 'pm,': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'wanted': 0.36; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'nothing': 0.38; 'talk': 0.38; 'system.': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'step': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'containing': 0.61; 'provide': 0.62; 'capable': 0.63; 'decided': 0.65; 'online': 0.70; 'million': 0.72; 'stop,': 0.84 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:to :content-type; bh=sD7if5OBvTIaA8jKHY76OKm453ZQPDDZtBuMz4UTHqI=; b=OUiirBVPJ/7a/o06cHIN6VaiJ2RDZBoVNNtGDD1nY7iWr29gLuw7e5FmStosvwV52S +fZzljui14JwDufhcsu+tv1J112NwCfHn0P9FO+2KJ/Z8edj8+Z4oM5kPTJYALosdizJ b6c5bKBhacdu8t+llsDqXYf9B7wYtJctgF3SGBwiaK+6dzzKiBZ8Jmjw25fYBs/IxX95 Dx5NWzWDmAAdll4DZFsrDN/euEY7k0xr/w1TCAXGse9+1p+WbT11YJl1c5t5JLe8VXYX 698cm39J7HZ2kUBdPnpbIaLA4p8Zv4zTAR4M8xsMxJQahAxiHcG9R/Ou+wwDqR9Y9Ef8 tjgQ== MIME-Version: 1.0 In-Reply-To: <508E1BC9.3000308@r3dsolutions.com> References: <6998a955-7b34-4f4f-b8d6-62d1028f7561@googlegroups.com> <4c024364-84df-403b-8b9e-4a4c8f06121c@googlegroups.com> <508e6649$0$29967$c3e8da3$5496439d@news.astraweb.com> <508E1BC9.3000308@r3dsolutions.com> Date: Tue, 30 Oct 2012 00:53:13 +1100 Subject: Re: Negative array indicies and slice() 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.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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351518795 news.xs4all.nl 6864 [2001:888:2000:d::a6]:50935 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32379 On Mon, Oct 29, 2012 at 5:01 PM, Andrew Robinson wrote: > Looking at some of the online programming notes -- a slice apparently > doesn't use an integer storage variable that is capable of arbitrary > expansion. =-O -- and hence, won't work for very large sized lists. That > actually explains some crashes I have noted in the past when working with 20 > million element lists that I wanted a slice of. I had *plenty* of ram on > that system. Can you provide links to these notes? I'm looking at cpython/Include/sliceobject.h that has this comment: /* A slice object containing start, stop, and step data members (the names are from range). After much talk with Guido, it was decided to let these be any arbitrary python type. Py_None stands for omitted values. */ Also, the code for slice objects in CPython works with Py_ssize_t (a signed quantity of the same length as size_t), which will allow at least 2**31 for an index. I would guess that your crashes were nothing to do with 20 million elements and slices. ChrisA