Below an illustration of what troubles me a bit. denis
class Seq(list): ''' specialized sequence type with improved str Override list's behaviour that list.__str__ calls __repr__ instead of __str__ on items. ??? ''' def __str__(self): if len(self) == 0: return '[]' text = str(self[0]) for item in self[1:]: text += " ,%s" %item return "[%s]" %text print 1.1, repr(1.1) print [1.1], Seq([1.1]) ==> 1.1 1.1000000000000001 [1.1000000000000001] [1.1] # By the way, I do not understand at all the behaviour of repr on rounded floats: x = round(1.1,1) print x, repr(x), "%s" %x 1.1 1.1000000000000001 1.1 ??? _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor