django-planet
Dec. 17, 2012

Worst python code I’ve ever written

published by Anže
in blog Anže’s Blog
original entry Worst python code I’ve ever written

I was doing my homework for the bioinformatics class when I started experimenting with scope in Python. The first thing I noticed was that Python list comprehensions don’t create a closure. This means that variables defined in the list comprehension bleed out into the current scope: