It's a great idea if you want to make small callable objects with limited (hidden) state, in a way that's easy to translate between any languages which support closures. For example, in JS:<p><pre><code>    function gencycle() {
        var args = Array.prototype.slice.apply(arguments),
            i = 0;
    
        return function cycle() {
            i = (i+1) % args.length;
            return args[i];
        }
    }
</code></pre>
I can then use gencycle("red", "green", "blue") when I want a function which gives me a rotation of colors.<p>In py26, I'd write it as:<p><pre><code>    class GenCycle(object):
        def __init__(self, *args):
            super(GenCycle, self).__init__()
            self.args = args
            self.i = 0
        
        def __call__(self):
            self.i = (self.i+1) % len(self.args)
            return self.args[self.i]
        </code></pre>
In Python 3, I'd have to choose between the two versions.