A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-June/015572.html below:

[Python-Dev] xrange vs generators

[Python-Dev] xrange vs generators [Python-Dev] xrange vs generatorsGuido van Rossum guido@digicool.com
Mon, 25 Jun 2001 10:47:50 -0400
[me]
> > Although xrange() objects currently support some sequence algebra,
> > that is mostly bogus and I don't think anyone in their right mind uses
> > it.

[theller]
> I _was_ using xrange as sets representing (potentially large)
> ranges of ints.
> Example:
> 
> positive = xrange(1, sys.maxint)
> 
> if num in positive:
>    ...
> 
> I didt follow the iterators discussion: would this
> continue to work?

No, it would break.  And I see another breakage too:

r = xrange(10)
for i in r:
    for j in r:
        print i, j

would not do the right thing if xrange() returned an iterator (because
iterators can only be used once).

This is too bad; I really wish that xrange() could die or be limited
entirely to for loops.  I wonder if we could put warnings on xrange()
uses beyond the most basic...?

--Guido van Rossum (home page: http://www.python.org/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4