magnitude
magnitude copied to clipboard
Nearest SI prefix
Love this library, but I have a feature request:
I'd love for a magnitude to have something like .ounit() which means "use whatever SI prefix keeps the displayed magnitude between 0 and 1000". Currently, I have to munge ounit strings, replacing 'M' with 'k' or 'G' where appropriate.
Thanks!
This is exactly what I was looking for. I wrote small python modules in the past for time and file size pretty-printing, and found magnitude when looking for something more general. I am not entirely sure yet whether .ounit() would be the right API; maybe some more explicit .pprint() function would be more appropriate, assuming that your use case also was pretty printing?