-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Mixed unit list conversion #568
Conversation
this would require modifying rust code, and i'm not sure how good of an idea it is, but implementing this functionality like so would be pretty cool:
|
That would be a really cool syntax for it, though I would need help with it as I have no experience with rust. If @sharkdp approves the addition of this syntax, I would love for it to happen though. |
Thank you very much! I'll review this soon. |
f891b3e
to
875a0ad
Compare
I like this very much. Can we please re-implement the existing functions Concerning special syntax for this: I definitely think it is worth thinking about, but let's please shift this to another ticket/PR. Another thing that we can discuss is a special display mode for unit list results. This is part of a more general topic I've been thinking about. It would be great if we had something like a |
Sure, no problem.
Agreed, it is definitely outside the scope of this PR. I really like your idea for the implementation too, I could imagine it being a nice way of implementing the |
Since @irevoire fixed problems arrising from calls to simplify, a lot of rounding/conversion bugs have been solved by extension. This lets the function work with a far simpler implementation.
875a0ad
to
136114f
Compare
I think the (Numbat-based) tests for DMS/DM/… need some adaptations from the string-based format to the list-based format. |
Yeah I completely forgot about that, but I'll fix that now |
I had to assert using strings to overcome the problems inherent with comparing floats. This did make me realize that it would be great to be able to provide a margin of error when comparing lists as well. Obviously not something for this PR, but something that would make testing list functions easier in the future. |
I can't figure out the problem with the documentation. I try to run the
I can't figure out why it fails now, as I haven't touched that file. Any help with this would be greatly appreciated. |
Oh, it looks like you don't use utf-8 as a default system encoding (but with open(path_in, "r", encoding="utf-8") as fin: If that works, please commit that change to your branch. |
This definitely helped, but I get a new error. It seems to be a missing dependency or similar.
|
Oh yes, sorry. You need Please let me know if I should simply generate the documentation for you. |
Ahh, of course. I'll install that and try again. Thank you for all the help.
No need, I would like to have it work so I can do it myself in future contributions. |
Thank you very much for the updates. I added an |
One thing I thought about was whether the implementation of the |
I would not be surprised if a lot of logic could be simplified there. I'll look into it and see what I can do. |
This PR adds a function that converts a value into a list of values with differing units. It aims to provide the functionality requested in #364, in a way that resembles the inspiration from GNU but with actual values and units, in contrast to the earlier string based implementations in #501.
It currently can not be used with the
to
keyword or the->
operators as it requires two arguments. I do plan to fix this by updating it to a curried version when/if closures (#347) are implemented.example: