[Tutor] Why begin a function name with an underscore

eryksun eryksun at gmail.com
Thu Aug 30 22:57:31 CEST 2012


On Thu, Aug 30, 2012 at 2:07 PM, Peter Otten <__peter__ at web.de> wrote:
>
> Allowing floats for a primality test is a can of worms anyway. You will
> inevitably run out of significant digits:

Allowing floats can also lead to type errors for operations that
require an integral type, but at least they're easier to catch with
proper testing. For example, line 323 will raise a TypeError if n is a
float:

http://code.google.com/p/pyprimes/source/browse/src/pyprimes.py#323

1.0 == 1, but range(1.0) is not allowed and neither is [0,1][1.0].


More information about the Tutor mailing list