help with simple script and strings
Kyle VanderBeek
kylev at kylev.com
Sat Apr 12 20:56:12 UTC 2008
On Sat, Apr 12, 2008 at 01:47:25PM -0700, Kyle VanderBeek wrote:
> Modifying the contents of a list that you're iterating over with a
> generator will give you strange results. Basically, you're causing the
> generator to lose its place. If you put the result in a new list (say,
> directories_new), this won't happen.
I mis-spoke on a minor detail: the list object doesn't use a generator,
it's just an interable in the usual sense. Sorry to confuse.
My technique still holds. Modifying something you're iterating over
will give you unexpected results.
--
kylev at kylev.com
Some people have a way with words, while others... erm... thingy.
More information about the Fedora-python-devel-list
mailing list