Consistency

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 16 05:29:08 PST 2015


John Colvin:

> I'm quite a fan of python's // operator for integer division, 
> especially when combined with python 3's choice to make / 
> always mean floating point division (i.e. 3/2 == float(3)/2, 
> 3//2 == 1). It recognises that integer division is a weird 
> thing and separates it from the much less weird floating point 
> division.

The C/D division operator semantics is a bug-prone design 
mistake, and this design was fixed in Python3 despite this has 
broken lot of Python2 code. It's a pitfall that a modern language 
must avoid (I don't know how Rust handles divisions, I hope they 
have removed this problem).

Bye,
bearophile


More information about the Digitalmars-d mailing list