This definition works: class X(object): def __init__(self, x): self.x = x def __str__(self): return "my name is %s" % self.x This doesn't: class X(object): def __init__(self, x): self.x = x def __str__(self): return "my name is %s" % self.x Both are accepted by C Python.