In need of a binge-and-purge idiom

Jeremy Fincher tweedgeezer at
Tue Mar 25 08:26:54 CET 2003

mlh at (Magnus Lie Hetland) wrote in message news:<slrnb7v8ai.bop.mlh at>...
> You should add "if acc" before you yield acc -- I don't want an empty
> acc (that only means several separators in a row -- which amounts to a
> single separator in my case).

That makes sense.  To be truly general, that should be a named
argument with a default to not return empty values.

> And, with that statement in place, you'd
> get the same duplication as before, as far as I can see. What is new
> about this (except putting it inside a generator)?

Simply that once writing it, the ugliness is contained in that one
function, and all your code that needs the behavior you describe can
be written much more beautifully :)


More information about the Python-list mailing list