On 31 August 2016 at 17:07, Chris Angelico <ros...@gmail.com> wrote: > On Wed, Aug 31, 2016 at 2:08 PM, Ken Kundert > <python-id...@shalmirane.com> wrote: >> > What's the mnemonic here? Why "r" for scale factor? >> >> My thinking was that r stands for real like f stands for float. >> With the base 2 scale factors, b stands for binary. > > "Real" has historically often been a synonym for "float", and it > doesn't really say that it'll be shown in engineering notation. But > then, we currently have format codes 'e', 'f', and 'g', and I don't > think there's much logic there beyond "exponential", "floating-point", > and... "general format"? I think that's a back-formation, frankly, and > 'g' was used simply because it comes nicely after 'e' and 'f'. (C's > decision, not Python's, fwiw.) I'll stick with 'r' for now, but it > could just as easily become 'h' to avoid confusion with %r for repr.
"h" would be a decent choice - it's not only a continuation of the e/f/g pattern, it's also very commonly used as a command line flag for "human-readable output" in system utilities that print numbers. The existing "alternate form" marker in string formatting could be used to request the use of the base 2 scaling prefixes rather than the base 10 ones: "#h". Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/