diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-11-07 12:50:11 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-11-07 12:50:11 (GMT) |
commit | bee54f53b1162d2229e15e30156e7f5516cf82ae (patch) | |
tree | b18b365b5a45f0f0180272aa7399c99448c38c9a /Doc | |
parent | 339293a37251dd46822dab270387b296841d49e0 (diff) | |
download | cpython-bee54f53b1162d2229e15e30156e7f5516cf82ae.zip cpython-bee54f53b1162d2229e15e30156e7f5516cf82ae.tar.gz cpython-bee54f53b1162d2229e15e30156e7f5516cf82ae.tar.bz2 |
Merged revisions 86293 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86293 | mark.dickinson | 2010-11-07 12:48:18 +0000 (Sun, 07 Nov 2010) | 1 line
Issue #10145: the float.is_integer method was undocumented.
........
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/stdtypes.rst | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 011bb6a..783b750 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -466,10 +466,20 @@ The float type has some additional methods. .. method:: float.as_integer_ratio() - Return a pair of integers whose ratio is exactly equal to the - original float and with a positive denominator. Raises - :exc:`OverflowError` on infinities and a :exc:`ValueError` on - NaNs. + Return a pair of integers whose ratio is exactly equal to the + original float and with a positive denominator. Raises + :exc:`OverflowError` on infinities and a :exc:`ValueError` on + NaNs. + +.. method:: float.is_integer() + + Return ``True`` if the float instance is finite with integral + value, and ``False`` otherwise:: + + >>> (-2.0).is_integer() + True + >>> (3.2).is_integer() + False Two methods support conversion to and from hexadecimal strings. Since Python's floats are stored |