On 04/27/10 10:47, MRAB wrote: > Mark Dickinson wrote: >> On Apr 26, 4:36 am, Keith <keith.braff...@gmail.com> wrote: >>> I am considering writing a PEP for the inclusion of an engineering >>> format specifier, and would appreciate input from others. >> >>> [...] >> >>> I am thinking that if we simply added something like %n (for eNgineer) >>> to the list of format specifiers that we could make life easier for >>> engineers: >>> >>> ("%n" % 12345) == "12.345e+03" >>> ("%n" % 1234) == "1.234e+03" >>> ("%n" % 123) == "123e+00" >>> ("%n" % 1.2345e-5) == "12.345e+06" >> >> I don't think there's much chance of getting changes to old-style >> string formatting accepted; you might be better off aiming at the new- >> style string formatting. (And there, the 'n' modifier is already >> taken for internationalization, so you'd have to find something >> different. :) >> > "e" is already used, "n" is already used, "g" is already used, etc > > "t" for "powers of a thousand", perhaps? (Or "m"?)
or perhaps as an extension to 'e', activated by '3e' (but that's occupied for adding spaces, need to think of another way...) -- http://mail.python.org/mailman/listinfo/python-list