Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Strange range Date: Sat, 2 Apr 2016 01:50:06 +1100 Lines: 19 Message-ID: References: <87y48xjwqq.fsf@elektro.pacujo.net> <1459521729.2604028.565815842.7D7557F9@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de rql0XplfRm6+b7plR6EtJgUrc7Ptc4JefRc17D4n5chA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'cc:addr:python-list': 0.09; 'collections': 0.09; 'implies': 0.09; 'iterate': 0.09; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hmm.': 0.16; 'iterator': 0.16; 'objection': 0.16; 'received:209.85.223.173': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sense,': 0.16; 'statement.': 0.16; 'which,': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'suppose': 0.22; 'am,': 0.23; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'chris': 0.26; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'mind,': 0.29; 'objects': 0.29; 'received:google.com': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'method': 0.37; 'received:209': 0.38; 'means': 0.39; 'applying': 0.70; 'accurately': 0.84; 'chrisa': 0.84; 'to:none': 0.91 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; bh=UaiKIvIPL/XZHPqcWbwJ++1gdsVv1c7AQJKOl8AjFc0=; b=V3vmZM2RqQGf/0iBu36/ZUpQIqcH1XhZcMrcXaqh61/OUDr6cmTWM/HwB63Iy0Ox0Q m2xO8bnTIjHKU8+/UZ6Au6vV2/WkNUvMa7FEAG/+Kixr5UyiCCLZUrmh2GBl9FVJ8EJG 1LanKrP9nud62NqC7qlZ/oZHdtp5XnN6aTf9gyHvlm6LXPQY8BgjcJ9CH3mW5yhm9MBn 6tS7EI+uVvvswOhyhNOmtS9//lVfewXIXUIsUCulKBtKQzBFqbA5JZgekWnaQER7YC34 5BtBBUFss2/TkFCjFkQanzrY8PjL3KuPwGHsh2pLH7XKyEK1GgYwaXhYu/aTDJRBrJ60 /vOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=UaiKIvIPL/XZHPqcWbwJ++1gdsVv1c7AQJKOl8AjFc0=; b=V5Jc6YIQ8DebBin1UQ5f4fcXfNQozR1dTtdD2wqOmPtUh6Py0BA1vZhfKEc2MF0Rn2 a3CwSPYmzLPRAp1AfF61E4B6VBWBLkqluGqrB8b34fKm6aA+LYPgbBtuJEXAEqiczlH9 5DHhrfqR7dxApR3+i+90cnMAyyKRg8hk57jx/IUId+7XH7TNQHymGwRY2lme6UKae9UE WOciNmBt2lbAtt63ZFNHBP7uOY9tw/jWZT/zpmeZ0fX3BS355EfxGizJfb1ZOXfJEMQ2 X1pb+EcPgBGMjxpd7veJ0EAErlj2fb0LuqX6acuACtvnmPsJC3K0gpMVStmltC91zXoU s6Rg== X-Gm-Message-State: AD7BkJIsM9ctpMbfYGnYFs+ywKkrexXbtCPqmcIu6hhTOMl9oYbLKR2f68UTvJlK7or1BX87UicbRnT595jCzQ== X-Received: by 10.107.137.101 with SMTP id l98mr5008035iod.31.1459522206992; Fri, 01 Apr 2016 07:50:06 -0700 (PDT) In-Reply-To: <1459521729.2604028.565815842.7D7557F9@webmail.messagingengine.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:106235 On Sat, Apr 2, 2016 at 1:42 AM, Random832 wrote: > On Fri, Apr 1, 2016, at 09:24, Chris Angelico wrote: >> It is an iterable. It is not a factory, as that implies that you call >> it. > > I do have an objection to this statement. It's perfectly reasonable to > describe the factory pattern as applying to objects on which you call a > method to return the new object you are interested in. In this sense, > all collections are iterator factories. Hmm. I suppose that would be reasonable, if you expect to call range_object.__iter__() - but you shouldn't. You should call iter(range_object), which, to my mind, means that *iter* is an iterator factory. Anyway, the word "iterable" accurately sums up the state: it's a thing you can iterate over. ChrisA