
Chris Rebert wrote:
On Wed, Aug 27, 2008 at 4:17 PM, Terry Reedy <tjreedy@udel.edu> wrote:
To me, the drive to replace all for loops with list comps is mis-directed. There is no end to the clauses people could propose to add: while, when, whatever, until, unless. mapped_to, transformed_by, and so on. The result would soon by something quite different from Python as we know it.
Indeed, probably something approaching Common Lisp's overcomplicated "loop" macro: http://www.unixuser.org/~euske/doc/cl/loop.html
- Chris
Doesn't have to be that bad. I'd personally like a way to make a loop expression that returns a list, with two operators that stuff new things on and update old ones. That's most likely a reflection of my expression-based-but-not-purely style, though. One thing I've noticed in this discussion is that people seem to want the "as" keyword to operate as a general expression-assignment operator. Is that worth adding to the language? There would be no possibility of getting it mixed up with "==", and the word as an infix operator is sufficiently ugly that people would prefer "=" in general. Neil