Oh Dear
Walter Bright
newshound1 at digitalmars.com
Sun Jul 12 15:13:29 PDT 2009
bearophile wrote:
> Walter Bright:
>> The result of / depends on which version of Python you're using:
>> http://www.python.org/doc/2.2.3/whatsnew/node7.html
>
> I have used Python 2.6, and the numbers I have shown you are correct for Python 3.1 too.
> I don't like how the % behaves in C when there can be negative numbers.
According to the python pep, the integer / divide semantics changed from
"C" style to match what the floating point / does. While this makes
sense for a language that is typeless, it doesn't work for D because:
1. it would cause D code to silently produce different results than the
corresponding C/C++ code. This is extremely important, as I guarantee
that when someone new tries porting existing C code to D, and it doesn't
work, their conclusion will not be "perhaps I should recode the /
expression", it will be "D sux". Note that there is no way the compiler
could issue a warning about this as it cannot determine a dependency on
the rounding method.
2. it is slower than the current method.
More information about the Digitalmars-d
mailing list