This is my class (as simple as it can be):
class MyClass(): def __init__(self, id): self.id = id def __str__(self): return \"MyClass
>>> class MyClass(): ... def __init__(self, id): ... self.id = id ... def __repr__(self): ... return "MyClass #%d" % self.id ... >>> c = MyClass(5) >>> c MyClass #5
def __repr__(self): return 'MyClass #%d' % (self.id,)