[Python-Dev] [PEP204] Range Literals
Guido van Rossum
Thu, 13 Jul 2000 18:05:12 -0500
> As I already wrote Barry, I'll do this one -- but only if it's a no-brainer.
> The patch is already written and I hadn't heard complaints about the syntax,
> but now I hear some rumbling about how it should be a generator instead of a
> list constructor. I don't feel like digging into that particular dungball,
> though, having no experience what so ever with iterators, generators or
> languages that implement those. (So I'm a C and Python programmar by heart.
> Sue me.)
It should be sweet and simple. Make it return a list, just like
range(). The whole point is that an optimizer can recognize that you
are doing "for i in [0:10]: ...", and use a generator anyway -- but
that's a thing for later to implement.
Also, don't bother with (::) to return an xrange as has been proposed.
--Guido van Rossum (home page: http://dinsdale.python.org/~guido/)