In [1]:
from __future__ import print_function
In [2]:
class Foo:
def write(self, s):
print(s.upper())
In [3]:
hoo = Foo()
In [4]:
print('hello world', file=hoo)