@@ -0,0 +1,983 @@
+class IOManipulator(object):%0A    def __init__(self, function=None):%0A        self.function = function%0A    def do(self, output):%0A        self.function(output)%0A%0Adef do_endl(stream):%0A    stream.output.write('%5Cn')%0A    stream.output.flush()%0A%0Aendl = IOManipulator(do_endl)%0A%0Aclass OStream(object):%0A    def __init__(self, output=None):%0A        if output is None:%0A            import sys%0A            output = sys.stdout%0A            self.output = output%0A            self.format = '%25s'%0A            %0A    def __lshift__(self, thing):%0A        '''Python will call this function when you use %3C%3C with left operator being OStream%0A        '''%0A        if isinstance(thing, IOManipulator):%0A            thing.do(self)%0A        else:%0A            self.output.write(self.format %25 thing)%0A            self.format = '%25s'%0A        return self%0A    %0Adef example_main():%0A    cout = OStream()%0A    cout %3C%3C %22The average of %22 %3C%3C 1 %3C%3C %22 and %22 %3C%3C 3 %3C%3C %22 is %22 %3C%3C (1+3)/2 %3C%3C endl%0A%0Aif __name__ == '__main__':%0A    example_main()%0A

Add cout script