On Mar 21, 2018 05:40, "Steven D'Aprano" <st...@pearwood.info> wrote:
I don't want to change the behaviour of pow(), but we shouldn't dismiss the possibility of some other numeric function wanting to treat values N.0 and N the same. Let's say, an is_prime(x) function that supports floats as well as ints: is_prime(3.0) # True is_prime(3.00001) # False For me this is an argument against is_integer() rather than for it :-). is_prime(float) should *obviously*[1] be a TypeError. Primality is only meaningfully defined over the domain of integers, and this is a case where operator.index is exactly what you want. Of course it's just an example, and perhaps there are other, better examples. But it makes me nervous that this is the best example you could quickly come up with. -n [1] Warning: I am not Dutch.
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com