If I do:
print "The item is:" + str(1) + "."
I will get:
The item is 1.
But if I use an object of my class, dbref (here x is one of it), and try to stringify it:
print "The item is:" + str(x) + "."
I will get:
The item is <mufdatatypes.dbref instance at 0xb74a2bec>.
I’d rather it return a string of my own design. Is there a function I can define within my class that will let me do this?
Return a string from the
__str__()method. Like so: