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/2002-June/025016.html below:

[Python-Dev] xrange identity crisis

[Python-Dev] xrange identity crisis [Python-Dev] xrange identity crisisMartin v. Loewis martin@v.loewis.de
04 Jun 2002 23:47:00 +0200
Guido van Rossum <guido@python.org> writes:

> The current xrange code (from SF patch #551410) uses the xrange object
> as both an iterator and iterable, and has an extra flag to make things
> work right when the same object is iterated over more than once.
> Without doing more of a review, I can only say that I'm a but
> uncomfortable with that approach.  Something like the more recent code
> that Raymond H added to listobject.c to add a custom iterator makes
> more sense.  But perhaps it is defensible.

The main defense is that the typical use case is 

for i in xrange(len(some_list))

In that case, it is desirable not to create an additional object, and
nobody will notice the difference.

Regards,
Martin





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