FAQ
In article <698f09f8.0303242326.60c2f3b5 at posting.google.com>, Jeremy
Fincher wrote:
mlh at furu.idi.ntnu.no (Magnus Lie Hetland) wrote in message news:<slrnb7v8ai.bop.mlh at furu.idi.ntnu.no>...
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.
Maybe. I wasn't really looking for a general function/generator, but
for an idiom (i.e. a way of solving this with basic tools). An
unrealistic wish, perhaps :)
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 :) Indeed.
Jeremy
--
Magnus Lie Hetland "Nothing shocks me. I'm a scientist."
http://hetland.org -- Indiana Jones

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 9 of 12 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedMar 23, '03 at 6:20p
activeMar 26, '03 at 6:14a
posts12
users7
websitepython.org

People

Translate

site design / logo © 2022 Grokbase