Contribute Media
A thank you to everyone who makes this possible: Read More

from __magic__ import wtf


Just because you can doesn't mean you should. Python provides facilities like __metaclass__, __getattr__, __call__, and others which allow programmers to do a lot of clever stuff. This magical code is fun to write, concise, and can be quite elegant. However, too much magic is dangerous, particularly in library code. You may think your code is clever and fun, but your colleague trying to maintain it or re-use it in another project later will probably be confused and annoyed by much thought is needed to understand what the heck your fancy code is doing. We will discuss finding the balance between fun magic and boring but clear with some examples of questionable magic we've encountered in Spotify's Python corpus.


Improve this page