Q: Feature Wish: "%" Extension

Rainer Deyke root at rainerdeyke.com
Wed Nov 7 09:09:09 EST 2001


"Hans Nowak" <wurmy at earthlink.net> wrote in message
news:3BE9338B.70257B81 at earthlink.net...
>
> Rainer Deyke wrote:
>
> > "John Roth" <johnroth at ameritech.net> wrote in message
> > news:tugphsjop81s04 at news.supernews.com...
> > > Integer division is not an inverse of integer multiplication,
therefore
> > > the proposed counterexample fails.
> >
> > What do you mean?  '(a * b) / b' equals 'a' for all integers 'a' and 'b'
> > (assuming 'a * b' evaluates without overflow), except when 'b' equals 0.
>
> I think the idea is that (a / b) * b does not equal a in current
> (non-__future__) Python...?
>
> >>> (9 / 4) * 4
> 8

That would be a multiplication problem, wouldn't it?  By the same token, we
could want '(2 * 0) / 0 == 2'.  It is the nature of integer multiplication
that 'a * b' yields a multiple of 'b'.  Integer division is the inverse of
that, except that you can't divide by zero.  If you feed it input that isn't
the result of multiplication, it's your own damn fault.


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list