diff options
author | Shantanu <12621235+hauntsaninja@users.noreply.github.com> | 2022-12-24 02:30:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 02:30:27 (GMT) |
commit | 3e46f9fe05b40ee42009878620f448d3a4b44cb5 (patch) | |
tree | 73a990d85dd392b93303c8fe98276029eef15f5b /Misc | |
parent | a23cb72ac82372fac05ba36ce08923840ca0de06 (diff) | |
download | cpython-3e46f9fe05b40ee42009878620f448d3a4b44cb5.zip cpython-3e46f9fe05b40ee42009878620f448d3a4b44cb5.tar.gz cpython-3e46f9fe05b40ee42009878620f448d3a4b44cb5.tar.bz2 |
gh-100268: Add is_integer method to int (#100439)
This improves the lives of type annotation users of `float` - which type checkers implicitly treat as `int|float` because that is what most code actually wants. Before this change a `.is_integer()` method could not be assumed to exist on things annotated as `: float` due to the method not existing on both types.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2022-12-22-21-56-08.gh-issue-100268.xw_phB.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-12-22-21-56-08.gh-issue-100268.xw_phB.rst b/Misc/NEWS.d/next/Core and Builtins/2022-12-22-21-56-08.gh-issue-100268.xw_phB.rst new file mode 100644 index 0000000..73d04c1 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2022-12-22-21-56-08.gh-issue-100268.xw_phB.rst @@ -0,0 +1 @@ +Add :meth:`int.is_integer` to improve duck type compatibility between :class:`int` and :class:`float`. |