Pythonic music theory