Guido van Rossum wrote: > In order to support the use cases for %s and %r, I propose to allow > appending a single letter 's', 'r' or 'f' to the width_specifier > (*not* the conversion_specifier): > > 'r' always calls repr() on the object; > 's' always calls str() on the object; > 'f' calls the object's __format__() method passing it the > conversion_specifier, or if it has no __format__() method, calls > repr() on it. This is also the default.
Won't it seem a bit unintuitive that 'r' and 's' have to come before the colon, whereas all the others come after it? It would seem more logical to me if 'r' and 's' were treated as special cases of the conversion specifier that are recognised before calling __format__. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a morning person.) | [EMAIL PROTECTED] +--------------------------------------+ _______________________________________________ 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
