[Python-Dev] Lockstep iteration - eureka! (original) (raw)

Tim Peters tim_one@email.msn.com
Tue, 15 Aug 2000 00:43:44 -0400


[Tim]

But if you add seq.items(), you had better add seq.keys() too, and seq.values() as a synonym for seq[:]. I guess the perceived advantage of adding seq.items() is that it supplies yet another incredibly slow and convoluted way to get at the for-loop index? "Ah, that's the ticket! Let's allocate gazillabytes of storage and compute all the indexes into a massive data structure up front, and then we can use the loop index that's already sitting there for free anyway to index into that and get back a redundant copy of itself!" .

[Peter Schneider-Kamp]]

That's a -1, right? <0.1 wink>

-0 if you also add .keys() and .values() (if you're going to hypergeneralize, don't go partway nuts -- then it's both more general than it should be yet still not as general as people will expect).

-1 if it's just seq.items().

+1 on an "indexing" clause (the BDFL liked that enough to implement it a few years ago, but it didn't go in then because he found some random putz who had used "indexing" as a vrbl name; but if doesn't need to be a keyword, even that lame (ask Just ) objection goes away).

sqrt(-1) on Barry's generator tease, because that's an imaginary proposal at this stage of the game.