Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106230

Re: Strange range

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Random832 <random832@fastmail.com>
Newsgroups comp.lang.python
Subject Re: Strange range
Date Fri, 01 Apr 2016 10:39:45 -0400
Lines 15
Message-ID <mailman.312.1459521588.28225.python-list@python.org> (permalink)
References <87y48xjwqq.fsf@elektro.pacujo.net> <56fe76f2$0$22141$c3e8da3$5496439d@news.astraweb.com> <87twjlju3i.fsf@elektro.pacujo.net>
Mime-Version 1.0
Content-Type text/plain
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de SBl7iYx+Oy/Sb3aqKeuhCw7bLNvZLaOFvPMypmrvWgow==
Return-Path <random832@fastmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'none:': 0.05; 'received:internal': 0.09; 'python': 0.10; 'assume': 0.11; 'def': 0.13; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'xrange': 0.16; 'wrote:': 0.16; 'latter': 0.22; 'header:In- Reply-To:1': 0.24; 'example': 0.26; 'fri,': 0.27; 'start,': 0.27; 'yield': 0.27; 'realize': 0.32; 'similar': 0.33; 'step': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'thought': 0.37; 'things': 0.38; 'received:66': 0.38; 'end': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'header:Message- Id:1': 0.61; 'caused': 0.61; 'more': 0.63; 'was:': 0.66; 'funny': 0.83
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=toquuCG/cB93DYk8MYCOtAlCWto=; b=sRgMfY Sek1Bcllw9WLBOMolUA0YSkxJkwILbMp74CuJ9v53Ys0D3S/OD0ifR7mt5lrvaGP +Njj4BYFS7Q+aQp5l1kQnUnBTSaqcd1uIbph1uuSLPCoOPe5RGyW2bss9cjqogQO rxtgovYlQP7vSP78WwSL7vd7qfPPRaRpE+ACc=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=toquuCG/cB93DYk 8MYCOtAlCWto=; b=V+osaSWHut4Ji7ipbULEGtMONP8AMreF/9tl+OJTzsExuTx nZiJAqWXu0Jf8qRAyjYvR1F6iB/0ODoFikLKS1Wt5eZN1pUM7oxbeFTA2MWxQeUw g1dmjQaxFrdGIEYyLqhs5orkJOkuzKdVsrA/CCQpcAxNqszrYTge/xEwgnsk=
X-Sasl-Enc JFRx3DR3PSUUWd8igz4rbfwEXOGt65fUj5Wym9EaOSwu 1459521585
X-Mailer MessagingEngine.com Webmail Interface - ajax-2373d6a1
In-Reply-To <87twjlju3i.fsf@elektro.pacujo.net>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:106230

Show key headers only | View raw


On Fri, Apr 1, 2016, at 10:12, Marko Rauhamaa wrote:
> Yes, I realize it now. I had thought it was:
> 
>     def range(start, end=None, step=1):
>         if end is None:
>             start, end = 0, start
>         i = start
>         while step * (end - i) > 0:
>             yield i
>             i += step

You know the other funny thing? Even people who understand this about
Python 3 ranges, many assume that python 2 xrange was more similar to
your latter example (possibly caused by the fact that python 2 had other
things such as dict.iteritems which _were_ mere iterators)

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-01 16:15 +0300
  Re: Strange range Chris Angelico <rosuav@gmail.com> - 2016-04-02 00:24 +1100
  Re: Strange range Steven D'Aprano <steve@pearwood.info> - 2016-04-02 00:26 +1100
    Re: Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-01 17:12 +0300
      Re: Strange range Random832 <random832@fastmail.com> - 2016-04-01 10:39 -0400
    Re: Strange range Fabien <fabien.maussion@gmail.com> - 2016-04-01 16:16 +0200
      Re: Strange range Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-01 17:28 +0300
      Re: Strange range Chris Angelico <rosuav@gmail.com> - 2016-04-02 01:31 +1100
        Re: Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-01 17:34 +0300
          Re: Strange range Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-04-01 17:44 +0300
          Re: Strange range Chris Angelico <rosuav@gmail.com> - 2016-04-02 01:45 +1100
            Re: Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-01 18:43 +0300
          Re: Strange range Erik <python@lucidity.plus.com> - 2016-04-01 20:58 +0100
            Re: Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-01 23:14 +0300
              Re: Strange range Rob Gaddi <rgaddi@highlandtechnology.invalid> - 2016-04-01 20:21 +0000
                Re: Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-01 23:44 +0300
              Re: Strange range Steven D'Aprano <steve@pearwood.info> - 2016-04-02 21:09 +1100
                Re: Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-02 13:48 +0300
          Re: Strange range Ned Batchelder <ned@nedbatchelder.com> - 2016-04-02 12:47 -0700
            Re: Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-02 23:44 +0300
              Re: Strange range Chris Angelico <rosuav@gmail.com> - 2016-04-03 07:05 +1000
                Re: Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-03 00:40 +0300
                Re: Strange range Ned Batchelder <ned@nedbatchelder.com> - 2016-04-02 14:50 -0700
                Re: Strange range Stephen Hansen <me+python@ixokai.io> - 2016-04-02 23:43 -0700
                Re: Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-03 09:58 +0300
                Re: Strange range Chris Angelico <rosuav@gmail.com> - 2016-04-03 17:10 +1000
                Re: Strange range Ethan Furman <ethan@stoneleaf.us> - 2016-04-03 09:28 -0700
                Re: Strange range Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-04-04 13:21 +0100
                Re: Strange range Chris Angelico <rosuav@gmail.com> - 2016-04-03 17:08 +1000
              Re: Strange range Steven D'Aprano <steve@pearwood.info> - 2016-04-03 14:43 +1000
                Re: Strange range Random832 <random832@fastmail.com> - 2016-04-03 01:20 -0400
                Re: Strange range Steven D'Aprano <steve@pearwood.info> - 2016-04-03 15:28 +1000
      Re: Strange range Marko Rauhamaa <marko@pacujo.net> - 2016-04-01 17:32 +0300
  Re: Strange range Random832 <random832@fastmail.com> - 2016-04-01 10:42 -0400
  Re: Strange range Chris Angelico <rosuav@gmail.com> - 2016-04-02 01:50 +1100
  Re: Strange range Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-01 08:52 -0600

csiph-web