Is using range() in for loops really Pythonic?
Ben Finney
bignose+hates-spam at benfinney.id.au
Tue May 13 19:34:31 EDT 2008
John Nagle <nagle at animats.com> writes:
> Matt Nordhoff wrote:
> > Well, you should use "xrange(10)" instead of "range(10)".
>
> CPython really is naive. That sort of thing should be a
> compile-time optimization.
Or even a case of the 'xrange' behaviour making 'range' obsolete.
Which, as I pointed out earlier in the thread, it is in Python 3.0.
--
\ "Yesterday I parked my car in a tow-away zone. When I came back |
`\ the entire area was missing." -- Steven Wright |
_o__) |
Ben Finney
More information about the Python-list
mailing list