for / while else doesn't make sense

Jon Ribbens jon+usenet at unequivocal.co.uk
Sun May 22 14:06:17 EDT 2016


On 2016-05-22, Random832 <random832 at fastmail.com> wrote:
> On Sun, May 22, 2016, at 11:52, Jon Ribbens wrote:
>> No, it *adheres* to the principle of least surprise. Floats appearing
>> out of nowhere is surprising. Python 2's behaviour adhered to the
>> principle, and Python 3's breaks it.
>
> Disregarding for the moment the particular imperfections of the float
> representation (which would be gone if we used Fraction instead), this
> is only true if the concrete types of results are regarded as part of
> the result rather than as an implementation detail for how best to
> return the requested value.
>
> I think it would be entirely reasonable for Fractions to not only appear
> out of nowhere, but to *disappear* when an operation on them yields a
> value which is an integer.
>
> Values are more important than types. Types are less important than
> values.

This would be true if we had some Grand Unified Lossless Number Type.
Unfortunately, we don't, and we're not likely to any time soon.



More information about the Python-list mailing list