On 8/3/07, Adam Olsen <[EMAIL PROTECTED]> wrote: > class MyFloat: > def __format__(self, type, ...): > if type == 'D': > return custom format > else: > return float(self).__format__(type, ...)
Oops, explicitly falling back to float is unnecessary here. It should instead be: class MyFloat: def __float__(self): return self as float def __format__(self, type, ...): if type == 'D': return custom format else: return NotImplemented # Falls back to self.__float__().__format__() -- Adam Olsen, aka Rhamphoryncus _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com