On Sat, 23 Jul 2005 13:50:36 -0400, Mike Meyer wrote: >> I don't think this is particularly useful behaviour. How do you use it? > > def __str__(self): > return self._format % self
That doesn't work. It calls self.__str__ recursively until Python halts the process. >>> class Thing(dict): ... _format = "Thing %s is good." ... def __str__(self): ... return self._format % self ... >>> X = Thing() >>> X # calls __repr__ so is safe {} >>> str(X) # not safe File "<stdin>", line 4, in __str__ File "<stdin>", line 4, in __str__ ... File "<stdin>", line 4, in __str__ File "<stdin>", line 4, in __str__ RuntimeError: maximum recursion depth exceeded -- Steven. -- http://mail.python.org/mailman/listinfo/python-list