In [1]:
class Foo:
    def write(self, s):
        print s.upper()

In [2]:
hoo = Foo()

In [3]:
print >>hoo, 'hello world'


HELLO WORLD