rsalmei/alive-progress

Commas in the numbers?

xevg opened this issue · 12 comments

xevg commented

Is there a way to put commas into the number? I tried passing in a formatted string as monitor, but that didn't work.

I didn't quite get what you're asking.
Please send some code example of what you tried, so I can help you.

Well, I'm closing this. Please reply if still needed.

xevg commented

I apologize, I did not see your original reply. I simply mean I would like the numbers to be 1,234,567 instead of 1234567. When dealing with large number of loops, it’s easier to see where it is with those indicators.

Hey, no problem.

Humm, now I got it. That's kinda tricky actually, because of internationalization/locale issues.
I can try to find out what Python provides in this regard.

Oh, have you seen my latest version, which supports SI scaling? In this mode the comma/dot does appear, together with a prefix like k or M. Wouldn't that work for you? If you're dealing with such large numbers, the scaling should make them much more friendly.

xevg commented

It might. Is there any more documentation on the scale and precision? I don't know what SI, IEC, SI2 are.

@xevg I think the prefixes used are here: https://en.wikipedia.org/wiki/Binary_prefix

See the sidebar:

image

It might. Is there any more documentation on the scale and precision? I don't know what SI, IEC, SI2 are.

Here is what I wrote in another project of mine: https://github.com/rsalmei/about-time#features

xevg commented

I modified my code to use that. Not exactly what I wanted, but it will do. Thank you.

You're welcome.

xevg commented

I decided that I still wanted the commas, so I made the changes to the code and made a pull request. :)

Thanks, but the code was pretty far from what would be needed, and I closed it.
If you really want to contribute, we could think together on the best naming and approach to achieve consistency and performance. Actually, even if such a feature actually makes sense, because one can get this effect pretty easily by simply customizing the widgets (now we know all it takes is a single comma within the format string).