One thing to remember when using List Comprehensions is that they "leak" their
temporary iteration variable to the outside.
what does that mean?
In the following example, we still have access to 'x' after we run the list comprehension.
foo = ['a', 'b', 'c']
my_list = [x for x in foo]
print x
output:
>> c
This behaviour is different from how a Generator Expression works.
We could have wrote the List Comprehension using a Generator Expression like this:
my_list = list(x for x in foo)
Now, the temporary variable we used is not accessible from outside the scope of the expression.
foo = ['a', 'b', 'c']
my_list = list(x for x in foo)
print x
output:
>> NameError: name 'x' is not defined
Note: This is fixed in Python 3000