I have a custom class like:
class foo(object):
def __init__(self, name):
self.__name = name
def get_name(self):
return self.__name
What I want to do is to write
test = foo("test")
print test
instead of
test = foo("test")
print test.get_name()
What is the magic method for doing this?