Talin wrote: > in > the case of an integer that is printed with leading zeros, the sign must > come *before* the padding: '+000000010'. It's not sufficient to simply > apply padding blindly to the output of __format__, which would give you > '000000+10'.
How about this, then: The apply_format function parses the alignment spec and passes the result to the __format__ method along with the format spec. The __format__ method can then choose to do its own alignment and padding to achieve the specified field width. If it returns something less than the specified width, apply_format then uses the default alignment algorithm. Then the __format__ method has complete control over the whole process if it wants, the only distinction being that the alignment spec has a fixed syntax whereas the format spec can be anything. -- Greg _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
