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

parse french unit names #53

Closed
walidsa3d opened this issue Dec 7, 2015 · 5 comments
Closed

parse french unit names #53

walidsa3d opened this issue Dec 7, 2015 · 5 comments
Assignees

Comments

@walidsa3d
Copy link

I want to be able to parse strings containing french units (mentiond here https://en.wikipedia.org/wiki/Octet_(computing)) , can you please support that?

@tbielawa
Copy link
Owner

tbielawa commented Dec 8, 2015

This is the most interesting request for enhancement that I've received to date, @walidsa3d. I'm thrilled!

I like this part the most of all, it makes my job easier:

Let's get one thing straight first, you're specifically requesting that in addition to the currently supported prefix units:

... that there will be companion octet classes, such as the NIST-octet (base 2) classes:

  • Kio
  • Eio
  • *io

... and the SI equivalents

  • ko
  • Eo
  • *o

Can you describe some use-cases for me? Such as what functionality you would want to interact with these units directly. Are you specifically looking to use the parse_string functionality? Honestly, I can't imagine why you'd want to code unusual units into any code, as far as sharing and comprehendability is concerned.

I'm not looking to reject this request, I only want to understand your use cases so I can better accommodate your request 👍

edited to fix the unit names in the list examples

@walidsa3d
Copy link
Author

Here is my use case : I was trying to convert human-readable strings like "1.5GB", "5MB" into bytes using parse_string. It worked until I stumbled on those french names: Mo instead of Mb, Go instead of Gb, Ko instead of Kb.

@tbielawa
Copy link
Owner

tbielawa commented Dec 8, 2015

Cool! I think to keep things simple, as I'm not too keen on the idea of adding 23 more classes for obscure units, I might implement it initially such that:

  • bitmath.parse_string("100Mio") would return a bitmath.MiB(100) instance
  • bitmath.parse_string("100ko") would return a bitmath.kB(100).
  • and so on...

I will write up some code later today after these meetings.

@tbielawa
Copy link
Owner

tbielawa commented Dec 8, 2015

@walidsa3d please give this a review for me. Also, I've updated the parse_string docs to note the support for octets. Please give that a read over as well. It will appear here

once the docs rebuild.

@tbielawa tbielawa reopened this Dec 8, 2015
@walidsa3d
Copy link
Author

Thanks, it works like charm :)

@tbielawa tbielawa closed this as completed Dec 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants