[Python-Dev] Re: PEP 276 Simple Iterator for ints

Armin Rigo arigo@ulb.ac.be
Mon, 19 Nov 2001 14:37:13 +0100 (MET)


Hello Skip,

On Sat, 17 Nov 2001, Skip Montanaro wrote:
> I was thinking more along the lines of generating C or assembler on the
> fly.

If you have Psyco in mind the difference is not worth any lengthy debate
about the syntax of Python. It already "knows" that range() always produce
ints and letting it know that xrange() does as well is not a problem. From
my very selfish point of view I would rather say that [0 .. 10] would
probably introduce a new byte-code instruction, which is more hassle to
support than a built-in function :-)

range() also has (not-yet-exploited) side benefits, e.g. we know that in
the one-argument form it will always produce positive integers (tagging
integers as "necessarily positive" would allow some minor optimizations in
constructions like "sequence[i]").


A bient=F4t,

Armin.