Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display "B" instead of "Byte" when creating strings #93

Open
beav opened this issue May 11, 2020 · 0 comments
Open

display "B" instead of "Byte" when creating strings #93

beav opened this issue May 11, 2020 · 0 comments

Comments

@beav
Copy link

beav commented May 11, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant