Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'read-only': 0.09; 'conformance': 0.16; 'container.': 0.16; 'containers': 0.16; 'docstring': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'integers.': 0.16; 'length.': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'sequence.': 0.16; 'wrote:': 0.18; '(the': 0.22; 'header:User-Agent:1': 0.23; 'comparing': 0.24; 'instance,': 0.24; 'string,': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; "doesn't": 0.30; 'container': 0.31; 'so-called': 0.31; 'view.': 0.31; 'subject:the': 0.34; 'agree': 0.35; 'definition': 0.35; 'objects': 0.35; 'there': 0.35; 'object,': 0.36; 'virtual': 0.37; 'so,': 0.37; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'range': 0.61; 'kind': 0.63; 'here': 0.66; '2015': 0.84; 'approach.': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=A/HiPsmG c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=Vhvw94NMJWsA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=JK_szWkZA1w0K6TmkaUA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 Date: Wed, 18 Feb 2015 18:04:08 +0000 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: What the Pythons docs means by "container" ? References: <71e8463f-2a60-4fb0-a5b7-0ca7cd3efece@googlegroups.com> <472c49ae-c2ce-4eda-b922-f16613722e31@googlegroups.com> <1d87da9c-ef64-4bd2-9179-e2aad908a9d0@googlegroups.com> In-Reply-To: <1d87da9c-ef64-4bd2-9179-e2aad908a9d0@googlegroups.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424282658 news.xs4all.nl 2883 [2001:888:2000:d::a6]:54619 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85803 On 2015-02-18 02:14, candide wrote: > Le mercredi 18 février 2015 01:50:16 UTC+1, Chris Angelico a écrit : > >> So, what's a container? It's a thing that you put other objects >> into. > > I agree with this approach. The important point to consider here is > the last word in your definition : "into". There is the container and > there is the content (the objects into). The so-called built-in > containers (list, string, etc) are in conformance with this view. > Now, regarding a range object as a container disagrees completely > with the definition given in the PLR : there is no contents and hence > there is no container. For instance, range(10**6) doesn't hold any > kind of object, there are no reference to the int objects 0, 1, 2, > ... As the range's docstring explains, range returns a VIRTUAL > sequence. > It's a virtual, read-only container that contains integers. Try comparing range(10) with tuple(range(10)). Both contain integers. Both have a length. Both can be indexed.