[pydotorg-www] Can't edit - https://wiki.python.org/moin/RangeGenerator

Chris Angelico rosuav at gmail.com
Sat Aug 27 15:35:17 EDT 2016


On Sat, Aug 27, 2016 at 10:34 PM, Mark Muir <markmuir87 at gmail.com> wrote:
> Hi,
>
> I can't even seem to sign up for an account (which, from what I've read
> would still not be sufficient).

Hi Mark!

It's not sufficient, true, but we try to be fairly responsive here at
granting editor access to legit people. What happens when you try to
sign up? Sometimes the server drags its feet for one reason or
another, and one of the admins needs to kick it in the behind.

> I was hoping to add a Python 3 compatible implementation of the proposed
> 'irange' function (https://wiki.python.org/moin/RangeGenerator):
>
> If someone would be willing to edit this page for me I'd be grateful.
> Unless, of course, this has already been implemented in Python 3, thus
> making my effort pointless :)

The default range object is most of this, except that it's reiterable
rather than being a one-shot generator. You could probably do this:

def irange(*args): return iter(range(*args))

The range object retains its endpoints, rather than creating all the
integers up-front, so it has the efficiency needed for large ranges.
If there's something that irange does and range doesn't, then feel
free to describe that use-case on the wiki (once you manage to get an
account).

ChrisA


More information about the pydotorg-www mailing list