Chris Angelico wrote:
I'd rather have to explicitly request floating-point division;

When you write / in Python 3, you *are* explicitly requesting
floating-point division.

Similarly, when you write // you're explicitly requesting
integer division.

I don't see the problem. You write whatever you mean and it
does what you tell it to do.

So either you keep a very close eye on everything to make sure you
don't have floats infecting your calculations,

If you have something that works exclusively on ints and someone
passes you a float, and you don't check for that, you'll have
problems anyway even if no division is involved at all.

There's no way that Python 3 division can *introduce* a float
into an integer calculation unless you write / somewhere where
you really meant //. But that's the same kind of mistake as
calling foo() when you meant to call bar(). You can't blame
the language for that.

but if you
encode the date into the first eight digits, then put the store number
in the next three, register number in the next three, and then the
last three are sequential. Should work the same, right?)

It'll work fine as long as you use // when extracting the parts.
If you use / then you're *explicitly* saying to do the calculation
in floating point, which would not be a sane thing to do.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to