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
496431ff
Unverified
Kaydet (Commit)
496431ff
authored
Mar 10, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Mar 10, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-26701: Improve documentation for the rounding special methods. (#6054)
üst
308eab97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
datamodel.rst
Doc/reference/datamodel.rst
+18
-12
No files found.
Doc/reference/datamodel.rst
Dosyayı görüntüle @
496431ff
...
...
@@ -2364,28 +2364,17 @@ left undefined.
.. method:: object.__complex__(self)
object.__int__(self)
object.__float__(self)
object.__round__(self, [,n])
.. index::
builtin: complex
builtin: int
builtin: float
builtin: round
Called to implement the built-in functions :func:`complex`,
:func:`int`
, :func:`float` and :func:`round
`. Should return a value
:func:`int`
and :func:`float
`. Should return a value
of the appropriate type.
.. method:: object.__trunc__(self)
Called to implement :meth:`math.trunc`. Should return the value of the
object truncated to a :class:`numbers.Integral` (typically an
:class:`int`). If a class defines :meth:`__trunc__` but not
:meth:`__int__`, then :meth:`__trunc__` is called to implement the
built-in function :func:`int`.
.. method:: object.__index__(self)
Called to implement :func:`operator.index`, and whenever Python needs to
...
...
@@ -2401,6 +2390,23 @@ left undefined.
the same value.
.. method:: object.__round__(self, [,ndigits])
object.__trunc__(self)
object.__floor__(self)
object.__ceil__(self)
.. index:: builtin: round
Called to implement the built-in function :func:`round` and :mod:`math`
functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`.
Unless *ndigits* is passed to :meth:`!__round__` all these methods should
return the value of the object truncated to an :class:`~numbers.Integral`
(typically an :class:`int`).
If :meth:`__int__` is not defined then the built-in function :func:`int`
falls back to :meth:`__trunc__`.
.. _context-managers:
With Statement Context Managers
...
...
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