xrange question

Michael Hudson mwh at python.net
Tue May 8 03:43:31 EDT 2001


Greg Ewing <see at my.signature> writes:

> By the way, does anyone know why xrange isn't at least as
> fast in *all* cases? Considering that creating and indexing
> a tuple involves doing everything that creating and indexing
> an xrange object involves, plus more besides, I don't see
> why xrange should ever be slower.

My bet's on the special casing of list[int] in ceval.c.

Cheers,
M.

-- 
  ARTHUR:  Yes.  It was on display in the bottom of a locked filing
           cabinet stuck in a disused lavatory with a sign on the door
           saying "Beware of the Leopard".
                    -- The Hitch-Hikers Guide to the Galaxy, Episode 1



More information about the Python-list mailing list