On Wed, Apr 18, 2018 at 11:24:13PM +0300, Serhiy Storchaka wrote:
> Isn't everyone expect that x*2 == x + x? Isn't this the definition of
> multiplication?
I can't think of any counter-examples, but it wouldn't surprise me even
a tiny bit to learn of some.
> And when we have a multiplication, it can be generalized
> to division.
Not always. A counter-example is matrix multiplication, where
multiplication is non-commutative:
A*B ≠ B*A
and division is not defined at all. Instead, we multiply by the inverse
matrix, in the appropriate order
if A*B = C
then A = C*inv(B)
and B = inv(A)*C
And of course, when you talk about data types that aren't numeric,
division makes even less sense: string multiplication means repetition,
but string division has no obvious meaning.
--
Steve
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/