Python's += Is Weird
Image: William Warby on Flickr Here's a Python gotcha I've hit often enough to merit a blog post: x += 1 is weird in Python. It's compiled roughly like x = x + 1, with two surprising consequences. One is this familiar pitfall: >>> x = 0 [ ... ]
emptysquare.net