[Python-Dev] Lukewarm about range literals (original) (raw)
Tim Peters tim_one@email.msn.com
Tue, 29 Aug 2000 16:44:18 -0400
- Previous message: [Python-Dev] Lukewarm about range literals
- Next message: [Python-Dev] Lukewarm about range literals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Skip Montanaro]
One of the original arguments for range literals as I recall was that indexing of loops could get more efficient. The compiler would know that [0💯2] represents a series of integers and could conceivably generate more efficient loop indexing code (and so could Python2C and other compilers that generated C code). This argument doesn't seem to be showing up here at all. Does it carry no weight in the face of the relative inscrutability of the syntax?
It carries no weight at all for 2.0 because the patch didn't exploit the efficiency possibilities.
Which I expect are highly overrated (maybe 3% in a "good case" real-life loop) anyway. Even if they aren't, the same argument would apply to any other new syntax for this too, so in no case is it an argument in favor of this specific new syntax over alternative new syntaxes.
There are also well-known ways to optimize the current "range" exactly the way Python works today; e.g., compile two versions of the loop, one assuming range is the builtin, the other assuming it may be anything, then a quick runtime test to jump to the right one. Guido hates that idea just because it's despicable , but that's the kind of stuff optimizing compilers do, and if we're going to get excited about efficiency then we need to consider all sorts of despicable tricks like that.
In any case, I've spent 5 hours straight now digging thru Python email, have more backed up than when I started, and have gotten nothing done today toward moving 2.0b1 along. I'd love to talk more about all this, but there simply isn't the time for it now ...
- Previous message: [Python-Dev] Lukewarm about range literals
- Next message: [Python-Dev] Lukewarm about range literals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]