Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
07a605b1
Kaydet (Commit)
07a605b1
authored
Ara 15, 2010
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Entry for decimal and fractions.
üst
480ed78c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
8 deletions
+37
-8
3.2.rst
Doc/whatsnew/3.2.rst
+37
-8
No files found.
Doc/whatsnew/3.2.rst
Dosyayı görüntüle @
07a605b1
...
...
@@ -419,14 +419,6 @@ Some smaller changes made to the core Python language are:
(Added by Antoine Pitrou; :issue:`9757`.)
* Mark Dickinson crafted an elegant and efficient scheme for assuring that
different numeric datatypes will have the same hash value whenever their
actual values are equal::
>>> assert hash(Fraction(3, 2)) == hash(1.5) == \
hash(Decimal("1.5")) == hash(complex(1.5, 0))
(See :issue:`8188`.)
* Previously it was illegal to delete a name from the local namespace if it
occurs as a free variable in a nested block::
...
...
@@ -773,6 +765,43 @@ way to return a logging instance for use in the body of enclosed statements.
(Contributed by Michael Foord in :issue:`9110`.)
decimal and fractions
---------------------
Mark Dickinson crafted an elegant and efficient scheme for assuring that
different numeric datatypes will have the same hash value whenever their actual
values are equal (:issue:`8188`)::
>>> assert hash(Fraction(3, 2)) == hash(1.5) == \
hash(Decimal("1.5")) == hash(complex(1.5, 0))
An early decision to limit the inter-operability of various numeric types has
been relaxed. It is still unsupported (and ill-advised) to to have implicit
mixing in arithmetic expressions such as ``Decimal('1.1') + float('1.1')``
because the latter loses information in the process of constructing the binary
float. However, since existing floating point value can be converted losslessly
to either a decimal or rational representation, it makes sense to add them to
the constructor and to support mixed-type comparisons.
* The :class:`decimal.Decimal` contructor now accepts :class:`float` objects
directly so there in no longer a need to use the :meth:`~decimal.Decimal.from_float`
method.
* Mixed type comparisons are now fully supported so that
:class:`~decimal.Decimal` objects can be directly compared with :class:`float`
and :class:`fractions.Fraction`.
Similar changes were made to :class:`fractions.Fraction` so that the
:meth:`~fractions.Fraction.from_float()` and :meth:`~fractions.Fraction.from_decimal`
methods are no longer needed.
Another useful change for the :mod:`decimal` module is that the
:attr:`Context.clamp` attribute is now public. This is useful in creating
contexts that correspond to the decimal interchange formats specified in IEEE
754 (see :issue:`8540`).
(Contributed by Mark Dickinson.)
ftp
---
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment