当我打印我的类的实例时,我尝试返回一个字符串值。看来这不应该像我希望的那样工作。
class oObject (object):
def __init__(self, value):
self.value = value
def __str__(self):
return str(self.value)
def __repr__(self):
return str(self.value)
new = oObject(50)
# if I use print it's Okay
print new
# But if i try to do something like that ...
print new + '.kine'