How about adding rational fraction to Python?

Grant Edwards grante at visi.com
Tue Feb 26 18:29:58 CET 2008


On 2008-02-26, Steve Holden <steve at holdenweb.com> wrote:
> D'Arcy J.M. Cain wrote:
>> On Tue, 26 Feb 2008 08:55:22 -0500
>> "J. Cliff Dyer" <jcd at sdf.lonestar.org> wrote:
>>> Of course.  That's why I think you ought to spell it 3//4.  Nobody gets
>>> confused when a strange operator that they've never seen before does
>>> something unusual.  Average Jo off the street looks at python code and
>>> sees 3/4, and immediately thinks "aha! .75!"  Show the same person 3//4,
>> 
>> Why do we care what A. Jo thinks?  I would hope that A. Programmer Jo
>> would see "int {OP} int" and assume int result.  A. Jo isn't going to be
>> debugging anything.
>> 
>> If 3/4 ever returned 0.75 in any language I would drop that language.
>> 
> Prepare to drop Python then, as this will be the default behavior in 3.x

IIRC, That was the behavior in Pascal.  If you wanted integer
division you used the "div" operator.

-- 
Grant Edwards                   grante             Yow! I'm a nuclear
                                  at               submarine under the
                               visi.com            polar ice cap and I need
                                                   a Kleenex!



More information about the Python-list mailing list