On Wed, Aug 31, 2016 at 12:05 PM, Steven D'Aprano <st...@pearwood.info> wrote:
> (5) Is this really something that format() needs to understand? We can
> get a *much* richer and more powerful interface by turning it into a
> generalise numeric pretty-printing library, at the cost of a little less
> convenience.

Or just have a subclass of int or float that defines __format__, and
can do whatever it likes - including specifying the scale, if you so
choose. Say, something like:

{:s} -- autoscale, prefix
{:S} -- autoscale, full word
{:sM} -- scale to mega, print "M"
{:SM} -- scale to mega, print "Mega"
etc

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to