On Tuesday 28 October 2003 07:28 pm, Guido van Rossum wrote: ... > You're making a mountain of a molehill here, Alex. I know that in You have a point: when one is in love (and I still _am_ madly in love with Python!-), it's hard to admit of imperfections in the loved one:-). Even a tiny defect...:-). > group theory there are non-Abelian groups (for which AB != BA), but > I've never encountered one myself in programming; more typical such > non-commutative operations are modeled as __add__ rather than as > __mul__. I don't remember ever coding a __mul__ that I WANTED to be non-commutative, right. > Anyway, the real issue AFAICT is not that people depend on __rmul__'s > absence to raise a TypeError, but that people learn by example and > find __rmul__ isn't necessary by experimenting with integers. Or more seriously: they write what LOOK like perfectly adequate unit tests, but the numbers they try in "number * x" happen to be ints; so the unit tests pass -- but their code is broken because they forgot the __rmul__ and the unittests-with-ints didn't catch that. > The reason why it works at all for integers without __rmul__ is > complicated; it has to do with very tricky issues in trying to > implement multiplication of a sequence with an integer. That code has Yes, I think I understand some of that -- I included the analysis of the bug in my bugreport on SF. > gone through a number of iterators, and every time someone eventually > found a bug in it, so I'd rather leave the __rmul__ blemish than > uproot it again. If you can come up with a fix that doesn't break > sequence repetition I'd be open to accepting it (for 2.4 only, in 2.3 > there may be too much code depending on the bug) but only after > serious review -- and not by me, because I'm not all that familiar > with all the subtleties of that code any more. :-( I do have one weird idea that might help here (for 2.4), but I'd better post that separately because I suspect it's going to fuel its own long discussion thread. As things are, without an ability to distinguish a sequence from a number securely, and IF sequences must work w/o __rmul__ (but they didn't in classic classes...? and the docs don't indicate that...?) then I'm stumped. Who'd be the right people to review such proposed changes, btw? Alex
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4