3 ms·
Python lists are so “leaky”
- dalke 11y agoThe link that isn't user tagged is http://stackoverflow.com/questions/31218826/unexpected-output-from-listgenerator http://stackoverflow.com/questions/31218826/unexpected-outpu... . The short version is that under Python 2.x, "[1 for x in range(5)]" will 'leak' the variable and value for 'x' outside of the list comprehension. This mistake was not repeated for generator comprehensions, and is one of the many things that were fixed under Python 3.x.