In Python classes are first class objects, and you can easily do anything you could do with Java anonymous classes on the fly. Furthermore Java anonymous classes are usually used as a verbose replacement for a lack of closures. But in Python you can create closures and pass them around. (You do have to do some juggling to mutate variables, but 1 element arrays are only a slight pain to work with.)