Comments (8)
Oh my! That is quite a blunder. I'll get to work on fixing it.
from quantiphy.
Okay, I have fixed the version in github. New version is 2.8.3. I'll probably update pypi in the next few days.
Is it possible for you to check out the github version and try it out? You can let me know if you notice anything else I forgot.
from quantiphy.
Thanks for the fix.
The output is now working as expected, but the input is not.
from quantiphy import Quantity
Quantity.set_prefs(radix=',')
t= Quantity('3,123','m')
print(t.render())
yields 3,123 km
so we do have a comma in the output as wanted but since the quantity is now in km, it shows that the input comma was interpreted as a thousand seperator and not a radix. Maybe I was not clear in the last message - in comma radix systems, the comma is used exclusively as a radix. So 3,123 m should be equivalent to 3.123 m. Desired behavior: when radix is set to comma, reading a comma is the same as reading a point.
from quantiphy.
Actually, I had not implemented radix,comma support on the input; only on the output. However, I have updated it again and now the latest version should work. Please try the new version: 2.8.4. But you will need to set both radix and comma. By only setting radix, you still had ',' as the comma, and commas are stripped from the number.
from quantiphy.
I have updated again. It is now an error for radix and comma to be the same.
>>> from quantiphy import Quantity, QuantiPhyError
>>> try:
... with Quantity.prefs(radix=','):
... q = Quantity('3,123','m')
... print(q.render())
... except QuantiPhyError as e:
... print(e.render())
comma and radix must differ.
>>> try:
... with Quantity.prefs(radix=',', comma='.'):
... q = Quantity('3,123','m')
... print(q.render())
... except QuantiPhyError as e:
... print(e.render())
3,123 m
Version is now 2.8.5.
from quantiphy.
Great. I did limited testing and now it works as expected for comma radix standard. Also, I noticed that when input is set with radix=',', comma=' ' (official/ISO standard in my region), the input with a dot will still work - and I think it is a good thing because not everyone uses the local standard.
thanks again
from quantiphy.
Thank you. I really appreciate you reporting these issues.
I have updated the documentation and the version, it is no 2.8.6. The additions to the documentation can be found here. I will try to update pypi to in the next few days.
from quantiphy.
I have released the fixed version (vers 2.9) on pypi.
from quantiphy.
Related Issues (19)
- No trailing zeros? HOT 10
- Scaling Problem when entering Quantity HOT 2
- Upload wheels to PyPI HOT 1
- Consider removing setup_requires from setup.py HOT 3
- Consider using mu (µ) character in render method HOT 8
- Consider permissive license? HOT 1
- Converting nanoseconds to picoseconds? HOT 2
- Rounding is wrong HOT 1
- prec='full' fails HOT 3
- translate to Russian Cyrillic HOT 5
- setup.py no longer lists test requirements HOT 2
- Question on use HOT 3
- add type hints to allow static code analysis using mypy HOT 4
- Added to conda-forge HOT 4
- Quantity returns the wrong value HOT 10
- DeprecationWarning when running py.test HOT 2
- Adding new unicode character for micro: "µ" as an alternative to μ HOT 2
- Unitless scales HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quantiphy.