"Drew" <[EMAIL PROTECTED]> writes: > You're exactly on the mark. I guess I was just wondering if your first > example (that is, breaking the if statement away from the iteration) > was preferred rather than initially filtering and then iterating.
I think the multiple statement version is more in Python tradition. Python is historically an imperative, procedural language with some OO features. Iterators like that are a new Python feature and they have some annoying characteristics, like the way they mutate when you touch them. It's usually safest to create and consume them in the same place, e.g. creating some sequence and passing it through map, filter, etc. -- http://mail.python.org/mailman/listinfo/python-list