On Tue, Apr 29, 2008 at 10:36 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: .. > There are good reasons for having range() return an Iterable and not > an Iterator; e.g. > > R = range(N) > for i in R: > for j in R: > ....
You realize that in the snippet above whatever cycles you save by creating R once, you give away by creating iter(R) twice. So compared to range() returning an iterator and having to write for i in range(N): for j in range(N): ... you have 3 vs. 2 auxiliary objects created. And how often do you see code that will not benefit from being generalized from square to rectangular matrices? Lots of C code will go away if we nix the range object and leave only rangeiterator! _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com