On Thu, Feb 11, 2016 at 08:07:56PM +1000, Nick Coghlan wrote: > Given that str.format supports a thousands separator: > > >>> "{:,d}".format(100000000) > '100,000,000' > > it might be reasonable to permit "_" in place of "," in the format specifier.
+1 > However, I'm not sure when you'd use it aside from code generation, > and you can already insert the thousands separator and then replace > "," with "_". It's not always easy or convenient to call .replace(",", "_") on the output of format: "With my help, the {} caught {:,d} ants.".format("aardvark", 100000000) would need to be re-written as something like: py> "With my help, the {} caught {} ants.".format("aardvark", "{:,d}".format(100000000).replace(",", "_")) 'With my help, the aardvark caught 100_000_000 ants.' -- Steve _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com