How does this work?

Ben Finney ben+python at benfinney.id.au
Sun Jun 5 02:49:51 EDT 2011


Jon Clements <joncle at googlemail.com> writes:

> On Jun 5, 4:37 am, Ben Finney <ben+pyt... at benfinney.id.au> wrote:
> > <jyoun... at kc.rr.com> writes:
> > > (http://stackoverflow.com/questions/312443/how-do-you-split-a-list-int...)
> >
> > This is an excellent example of why “clever” code is to be shunned.
> > Whoever wrote this needs to spend more time trying to get their code
> > past a peer review; the above would be rejected until it was
> > re-written to be clear.
> >
> > Here is my attempt to write the above to be clear (and fixing a couple
> > of bugs too):

> Just my 2p, but isn't the itertools "grouper" recipe prudent?

Oh, if we go looking for ways to improve what that code is doing, there
are many things wrong with it, not least that it is re-implementing code
that already exists in the standard library.

But I'll leave that to the several superior answers at the Stackoverflow
question.

-- 
 \       “Pray, v. To ask that the laws of the universe be annulled in |
  `\     behalf of a single petitioner confessedly unworthy.” —Ambrose |
_o__)                           Bierce, _The Devil's Dictionary_, 1906 |
Ben Finney



More information about the Python-list mailing list