In article <7xd3jukyn9....@ruckus.brouhaha.com>,
 Paul Rubin <no.email@nospam.invalid> wrote:

> Roy Smith <r...@panix.com> writes:
> > changes = [ ]
> > for key in d.iterkeys():
> >   if is_bad(key):
> >     changes.append(key)
> 
>     changes = list(k for k in d if is_bad(k))
> 
> is a little bit more direct.

This is true.  I still file list comprehensions under "new fangled 
toys".  While I use them, and appreciate their value, I admit they're 
not always the first thing that comes to my mind.

OBTW,

>     changes = [k for k in d if is_bad(k)]

is even more direct :-)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to