Pep 238 Why new // operator (Non-integer Division)

Ken Seehof kens at sightreader.com
Sat Mar 17 00:08:38 CET 2001


Also, integer division is fairly common and a direct implementation is
significantly faster than floor(a/b).

Hey, I know: maybe "a//b" should be "a log b".  That way // is
the inverse operator of **.  :-)  Dang, if only I had time to
write PEPs. :-)

----- Original Message ----- 
From: "Tim Peters" <tim.one at home.com>
To: <python-list at python.org>
Sent: Friday, March 16, 2001 6:14 PM
Subject: RE: Pep 238 Why new // operator (Non-integer Division)


> [Gordon Williams]
> > Why do we need a new // operator to do the divide operation.  If
> > we want to do an integer divide with two reals why wont people just
> > use int(a/b).  For
> 
> 1. int() truncates.  Current i/j returns the floor.
> 
> 2. There is no bound on the sizes of i and j; it's very easy to
>    get Python long ints that don't fit in a Python float.
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 






More information about the Python-list mailing list