Nested list comprehension scope
Class scopes are a bit strange in Python 3, but it’s for a good reason. In Python 2, the iteration variables (i and j in your examples) leaked out of list comprehensions and would be included in the outside scope. This is because they were developed early in Python 2’s design, and they were based … Read more