Robert Smallshire <r...@sixty-north.com> added the comment: I've recently run into this issue impeding duck-typing between int and float again, when used in conjunction the int.__pow__, which may variously return an int or float depending on the value - not the type - of the arguments.
This is succinctly demonstrated by this example: >>> (10 ** -2).is_integer() False >>> (10 ** 2).is_integer() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'int' object has no attribute 'is_integer' I hear the argument about Python being harder to learn if more methods are supported on the built-in types - and perhaps float.is_integer should never have been added, but now its there, but I think Python is harder to learn and teach in the presence of these differences. Is is harder to learn "Real numbers support an is_integer() method", than it is "float supports an is_integer() method"? I'm happy to put in the work bring my original patches up-to-date, or create a PR depending on what current process is. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue26680> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com