Newbie question - better way to do this?

Steve Howell showell30 at yahoo.com
Sun May 27 18:10:34 EDT 2007


--- John Machin <sjmachin at lexicon.net> wrote:

(And you can
> > > ignore the fact that
> > > it won't find a sequence at the very end of
> words, that is fine for my
> > > purposes).
> > [...]
>
> Bzzzt. Needs the following code at the end:
> if accumulator:
>     doSomething(accumulator)
> 

FWIW the OP already conceded that bug, but you're
right that it's a common anti-pattern, which is just a
nice word for bug. :)

The itertools.groupby() function is a well-intended
attempt to steer folks away from this anti-pattern,
although I think it has usability issues, mostly
related to the docs (see other thread).




       
____________________________________________________________________________________Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting 



More information about the Python-list mailing list