On Mar 13, 8:53 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Paul Rubin a écrit :
[snip] > > Iterators like that are a new Python feature > > List comps are not that new (2.0 or 2.1 ?): > print "\n".join([contact for name, contact in contacts.items() \ > if search.match(name)]) You can write this, but: * it is difficult to argue that it is more readable than Paul's (or my) 'imperative' version; * it has no obvious performance benefit, in fact it creates a list unnecessarily (I know you could use a generator with recent python). > > and they have > > some annoying characteristics, like the way they mutate when you touch > > them. > > While sequences are iterables, all iterables are not sequences. Know > what you use, and you'll be fine. ...And know when to use for statements :) -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list