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!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'compiler': 0.05; 'python': 0.09; 'ast': 0.09; 'runtime': 0.09; 'slices': 0.09; 'subject:()': 0.09; 'typedef': 0.09; 'count.': 0.16; 'macro': 0.16; 'oct': 0.16; 'pyobject': 0.16; 'subject:array': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'pointer': 0.17; 'code.': 0.20; 'struct': 0.22; 'downloaded': 0.24; 'header:In-Reply-To:1': 0.25; 'skip:" 20': 0.26; 'andrew': 0.27; 'message-id:@mail.gmail.com': 0.27; 'represent': 0.28; 'node': 0.29; 'represented': 0.29; 'definition': 0.29; 'source': 0.29; 'code': 0.31; 'null': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'as:': 0.75; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=VvssCX8rnBvbs8dHXdePOqYb3pxGmPml8M6W2UCVndY=; b=Ae9m0MRaLW6YD7lTeENDH3ysbIi922OyA7iJjijW+JtSgDsmgoO5j59Q/a7q1jiZ8R wrcgzvOBco3cBK0S+pPiLlKmWLrGeUYYjXTHAslAHhkYpOKj6aMYuvbpsg8BnaFybgGX WS9PyeFYgq2Iv2+OQ9bkpw9misoKLnkeKO1dQ5lLr/Hw2yYw+CP3AA1v9rCUd9Pu7eZk bOUxUn0sGXEfIZfOB/+m6Iz5/l3mIDtEl22ORaYnpX4T7FRhs7hchb2dddysvUcPAVEN b/E3AqkXaj34QnSU3qAJbxKdA+5PJs9fb82z49bFwf1/Q7LFfq66AjYNaOFWKJ4aNLGp FxIQ== MIME-Version: 1.0 In-Reply-To: <508EC428.5080808@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> <508EC428.5080808@r3dsolutions.com> From: Ian Kelly Date: Mon, 29 Oct 2012 23:55:00 -0600 Subject: Re: Negative array indicies and slice() To: Python 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351576533 news.xs4all.nl 6972 [2001:888:2000:d::a6]:57680 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32466 On Mon, Oct 29, 2012 at 12:00 PM, Andrew Robinson wrote: > I downloaded the source code for python 3.3.0, as the tbz; > In the directory "Python-3.3.0/Python", look at Python-ast.c, line 2089 & > ff. Python-ast.c is part of the compiler code. That's not the struct used to represent the object at runtime, but the struct used to represent the AST node while compiling. For the runtime definition of slices, look at sliceobject.h and sliceobject.c. Slices are represented as: typedef struct { PyObject_HEAD PyObject *start, *stop, *step; /* not NULL */ } PySliceObject; "PyObject_HEAD" is a macro that incorporates the object type pointer and the reference count. Hence, 5 words.