This isn't a bug, it's absolutely expected behaviour. The author has just dressed it up in a blog post to make something of it, but anyone who has written a python library will know that code that isn't in a function (including function default arguments) gets evaluated on import. You don't need a C-extension to do that part. Then he messes with some internals, which isn't surprising either since python's philosophy is very much "internals are available - caveat emptor but if you want to mess with them go nuts".