feature request: mul
mis6 at pitt.edu
Tue Jun 17 23:13:39 CEST 2003
Jacek Generowicz <jacek.generowicz at cern.ch> wrote in message news:<tyfk7bkrbbt.fsf at pcepsft001.cern.ch>...
> mis6 at pitt.edu (Michele Simionato) writes:
> > import operator
> > multi_and=lambda it: reduce(operator.mul,it)
> > if multi_and(condition):
> > dosomething()
> > but frankly it is too ugly for my taste. Having
> > 'sum' and 'mul' the use cases for 'reduce' would
> > drop, which I think is a good thing.
> You don't like abstraction ?
1. Specific answer for this case:
As I said in the postscript,
"""I like the concept of reduce, but
not the syntax, and that is the reason why
I *never* use 'reduce' in my programs."""
I find the current syntax little readable. 'reduce' does not seems
very abstrac to me.
2. General answer.
No, I don't like abstraction for the sake of abstraction.
I like abstraction when actually it is useful and help
to explain/unify difficult concepts. I HATE abstraction
when it is intended to complicate simple things or when
you don't need it. On the other hand, excessive simplification
is also to be avoided:
Things should be made as simple as possible, but not simpler.
More information about the Python-list