Python's simplicity philosophy

Terry Reedy tjreedy at udel.edu
Fri Nov 14 11:49:59 EST 2003


"Patrick Maupin" <pmaupin at speakeasy.net> wrote in message
news:653b7547.0311140546.153c1d88 at posting.google.com...
> "Terry Reedy" wrote:
> >   I think it a big mistake (that should be repaired in 3.0) that
the
> > result start value was made optional, leading to unnecessary
empty-seq
> > exceptions.  I also think the order is wrong and should also be
fixed.
> > I believe it was placed last, after the seq of update values,  so
that
> > it could be made optional (which it should not be).  But it should
> > instead come before the seq, to match the update function (result,
> > seq-item) arg order.  This reversal has confused people, including
> > Guido.
>
> That makes some sense, but you'd _certainly_ have to move and/or
rename
> the function in that case.

I agree on moving.  I might rename reduce as induce simultaneously.

> Although this is not quite your preferred form, perhaps those in
such
> a rush to remove reduce() should consider this slight enhancement to
> sum(), to mollify those who don't want to see the functionality
disappear,
> but who could care less about the name of the function which
provides
> the functionality (e.g. sum(mylist,1,operator.mul) is slightly
> counterintuitive).

The problem with sum(seq, [base=0, [op = add]]) is that it *still* has
the result base case and the seq params in what I consider to be the
wrong order (unless the optional update function has the order of its
parameters reverses from reduce) -- and for the same reason of
optionality.

I need to write a coherent summary of my views on the ++s and --s of
reduce.

> functions will be removed at all cost. As soon as the implementers
> start porting their _own_ code to 3.0, I believe we'll starting
getting
> useful feedback, either of the form "itertools et al. has everything
> I need", or "boy, this SUCKS!  I really need map!"

I presume that part of why Guido wants a year to do 3.0 is just so he
can test alternatives with ports of his own code.

> (I'm curious, though, why you included "apply" in this list.  I've
> personally never needed it since the * enhancement to the call
syntax.)

I presume you mean as opposed to delete it altogether.  Because apply
can be used with map while * and ** cannot and at least one person has
said he uses that.

Terry J. Reedy








More information about the Python-list mailing list