bitmath
bitmath copied to clipboard
display "B" instead of "Byte" when creating strings
Howdy!
Right now, most strings use abbreviations. However, "Byte" is still written out all the way. This can cause consistency issues. For example:
import bitmath
with bitmath.format(fmt_str="{value:.2f} {unit}"):
formatted_size = bitmath.Byte(500).best_prefix()
print(str(formatted_size))
formatted_size = bitmath.Byte(2**25).best_prefix()
print(str(formatted_size))
formatted_size = bitmath.Byte(2**37).best_prefix()
print(str(formatted_size))
results in:
500.00 Byte
32.00 MiB
128.00 GiB
I can set format_plural to make Byte
pluralized, but this also pluralizes everything else:
500.00 Bytes
32.00 MiBs
128.00 GiBs
Would it be possible to use B
instead of Byte
? I think this would make everything match up. It should be ok to use B
per https://en.wikipedia.org/wiki/IEEE_1541-2002.