Returning self in f1 gives me <__main__.Test instance at 0x11ae48d40>. I would like to be able to return 'apples and cinnamon' but I can't do str(self). Is there a way for me to do this?
class Test:
def __init__(self, thing):
self.thing = thing
def f1(self, thing):
return self + " and " + thing #<<<
a = Test("apples")
a.f1("cinnamon")
applesis not the string representation ofself. Did you want to returnself.thinginstead?