[Tutor] Re: [Edu-sig] style question
Thu, 21 Feb 2002 07:33:40 -0800
>I hope this is sufficiently long winded enough. I have to run to a
>doctor's appointment anyway.
Yes, I understand now. The filter approach is indeed
safer and probably more readable. If used my reduce
approach, I should at least flag the trick with a
My earlier objection was if you go so far as to assume
an object messes with __eq__, you might as well imagine
it messes with __mod__ as well -- and that'd break the
filter method too. You showed where the programmer might
have some authentic, if misguided, need to return 'true'
or 100 instead of 1, whereas my messing with % was just
evil. On the other hand, one can imagine an equally
misguided, yet well-meaning programmer who thinks % is
obscure enough to be fair game for overriding in objects
that otherwise behave like integers. Moral: there's
only so far you can go to compensate for what others
might do with objects.