[Python-ideas] Fixed point format for numbers with locale based separators

Steven D'Aprano steve at pearwood.info
Fri Jan 4 11:56:01 EST 2019


On Fri, Jan 04, 2019 at 03:57:53PM +0100, Łukasz Stelmach wrote:
> Hi,
> 
> I would like to present two pull requests[1][2] implementing fixed point
> presentation of numbers and ask for comments. The first is mine. I
> learnt about the second after publishing mine.

Before I look at the implementation, can you explain the functional 
requirements please?

In other words, what is the new feature you hope to have excepted? 
Explain the intention and the API (the interface). The implementation is 
the least important part :-)



[...]
> Formatting 1.23456789 * n (LC_ALL=3Dpl_PL.UTF-8)
>     | n |    ".2f" |    ".3n" |
>     |---+----------+----------|
>     | 1 |     1.23 |     1,23 |
>     | 2 |    12.35 |     12,3 |
>     | 3 |   123.46 |      123 |
>     | 4 |  1234.57 | 1,23e+03 |

I'm afraid I cannot work out what that table means. You say "Formatting 
1.23... * n" (multiplying by n) but the results shown aren't multiplied 
by n=2, n=3, n=4 as the table suggests.

Can you show what Python code you expect will produce the expected 
output?


Thank you.



-- 
Steve


More information about the Python-ideas mailing list