[issue3508] range() is not a generator when used in for's
Mark Dickinson
report at bugs.python.org
Wed Aug 6 09:26:37 CEST 2008
Mark Dickinson <dickinsm at gmail.com> added the comment:
The behavior of range is very unlikely to be changed in Python 2.x, for
backwards compatibility reasons.
But it's a great idea! So great, in fact, that it's already been
implemented for Python 3.0. :-) There range() behaves like a generator
(in all contexts); if you really want a list, you'd write:
list(range(2**20))
Thanks!
----------
nosy: +marketdickinson
resolution: -> rejected
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3508>
_______________________________________
More information about the Python-bugs-list
mailing list