On Tue, 7 Jun 2022 at 01:58, David Mertz, Ph.D. <david.me...@gmail.com> wrote:
> In [2]: def isEven(n):
>    ...:     return n/2 == n//2
>    ...:
>

Huh. That's a very strange way to write that predicate.

>>> isEven(20000000000000000)
True
>>> isEven(20000000000000001)
True
>>> isEven(20000000000000002)
False
>>> isEven(20000000000000003)
False
>>> isEven(20000000000000004)
True

Why not just "return n % 2 == 0" ?

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HDNXSZI24RIMJDHWOMPIWQXN4EZUA4Y3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to