Python from Wise Guy's Viewpoint
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Tue Oct 28 16:25:02 EST 2003
On Tue, 28 Oct 2003 08:57:34 -0800, Don Geddis wrote:
> Why would division on integers mean something different than division on
> (floating point) doubles?
Because C did it this way and many languages are copying its conventions.
And C did it because it used / for integer division before it had floating
point types.
I was responding to "Something that annoys me about many statically-typed
languages is the insistence that arithmetic operations should return the
same type as the operands. 2 / 4 is 1/2, not 0."
While it is true that many statically typed languages do that, it's not
a consequence of static typing (others don't). The only fault of static
typing here is that it makes this choice relatively harmless, compared to
dynamically typed languages where it's a serious problem if this choice
is made.
I was going to respond "making 2/4 equal to 0 is unrelated to static or
dynamic typing", but it *is* related, only in a subtle way.
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Python-list
mailing list