Guido on the history of Python

103

Python creator Guido van Rossum has been writing a series on the history of the language; the latest installment is titled From List Comprehensions to Generator Expressions“. “Why the differences, and why the changes to a more restrictive list comprehension in Python 3? The factors affecting the design were backwards compatibility, avoiding ambiguity, the desire for equivalence, and evolution of the language. Originally, Python (before it even had a version 🙂 only had the explicit for-loop. There is no ambiguity here for the part that comes after ‘in’: it is always followed by a colon. Therefore, I figured that if you wanted to loop over a bunch of known values, you shouldn’t be bothered with having to put parentheses around them.

Read more at LWN