fdecimal-0.2.0
توضیحات
Decimal compatability with float
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | fdecimal-0.2.0 |
| نام | fdecimal |
| نسخه کتابخانه | 0.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Ben Lopatin |
| ایمیل نویسنده | ben@benlopatin.com |
| آدرس صفحه اصلی | https://github.com/bennylope/fdecimal |
| آدرس اینترنتی | https://pypi.org/project/fdecimal/ |
| مجوز | BSD |
===============================
FDecimal
===============================
.. image:: https://img.shields.io/travis/bennylope/fdecimal.svg
:target: https://travis-ci.org/bennylope/fdecimal
.. image:: https://img.shields.io/pypi/v/fdecimal.svg
:target: https://pypi.python.org/pypi/fdecimal
Decimal compatability with float
* Free software: BSD license
Features
--------
Implicit float-to-Decimal coercion for arithmetic operations.
Instead of this::
>>> from decimal import Decimal
>>> Decimal(12.0) * 0.5
TypeError: unsupported operand type(s) for *: 'Decimal' and 'float'
Use FDecimal::
>>> from fdecimal import FDecimal
>>> FDecimal(12.0) * 0.5
Decimal('6.0')
As you can see it only solves part of the problem - the result still can't be
added with a float value without explicit type coercion, but it solves some
problems where (1) its not clear what type the other value will be, (2) you
don't want to add code explicitly handling that coercion, and (3) an
arithmetic surprises due to working with different numeric types are
acceptable.
TODO
----
* Missing operations, including mod, floor div
* Python 3 support
* Allow cdecimal swap-in
Done:
* Return FDecimal objects rather than Decimal objects
History
-------
0.2.0 (2016-01-14)
---------------------
* Add support for returning FDecimal objects from operations
0.1.0 (2016-01-14)
---------------------
* First release on PyPI.
نحوه نصب
نصب پکیج whl fdecimal-0.2.0:
pip install fdecimal-0.2.0.whl
نصب پکیج tar.gz fdecimal-0.2.0:
pip install fdecimal-0.2.0.tar.gz