I've got a simple class from which I create two objects. I now want to print the name of the object from within the class. So something like this:
class Example:
def printSelf(self):
print self
object1 = Example()
object2 = Example()
object1.printSelf()
object2.printSelf()
I need this to print:
object1
object2
Unfortunately this just prints <myModule.Example instance at 0xb67e77cc>
Does anybody know how I can do this?