Comment on PEP-0238

Perry Greenfield perry at stsci.edu
Mon Jul 9 11:08:47 EDT 2001


"Tim Peters" <tim.one at home.com> wrote in message
news:mailman.994532533.10229.python-list at python.org...
>> ...
>> 1. First we introduce a new function div() and a future statement that
>>   makes integer division return a float result for a specific module.
>
> I want to make a pitch for naming it idiv() instead.  The "i" should
> strongly remind that the result is an integer, something "div" says only
to
> former Pascal programmers.  Seems a Positive Good to me if, e.g.,
>
>    idiv(5.0, 3.0)
>
> returned 1 too; i.e., that idiv(i, j) mathematically return floor(i/j).

I sense some confusion here (or maybe I'm confused). The original point was
that
someone could simply search and replace the existing '/' operator with the
'div'
operator. The existing '/' does not guarantee an integer result (if one of
the operands
is a float for example). So providing an idiv operator that always returned
an
integer result would not suffice for the original desire which was to have
an
operator with the same semantics as the existing division operator. Or do I
misunderstand?

Perry Greenfield







More information about the Python-list mailing list