Translate this to python?

Robert Kern robert.kern at gmail.com
Fri Jan 6 20:31:36 CET 2006


Heiko Wundram wrote:
> Xavier Morel wrote:
> 
>>While the deprecation of xrange is not that "soon", it is part of the
>>Python 3000 PEP (http://www.python.org/peps/pep-3000.html#id38) along
>>with the deprecation of most FP-facilities of Python (filter, map,
>>reduce).
> 
> I know this, and that's one of the reasons I'm a little at odds with Python
> 3000... There are many good things in there (such as removing the
> FP-facilities which are much more clearly and cleverly implemented using
> generator- and list-comprehensions), but some things are so basic (such as
> xrange) I wouldn't want to have to implement them every time I need such a
> beast.
> 
> Unless of course range() becomes "more clever" and returns an iterator in
> case the amount of memory to store the needed range is too large, which
> would of course mean obfuscation at other places...

I believe range() will always return an iterator in Python 3000. See the first
item in the section "Built-In Changes" on http://wiki.python.org/moin/Python3.0.
xrange() will be going away because it will be utterly obsolete in every
conceivable way.

-- 
Robert Kern
robert.kern at gmail.com

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Python-list mailing list