Mike Meyer wrote: > First, remember the warnings about premature optimization.
Which is why I said the one-liner(your first one) is clean and clear, and bug free in one go. > > use = set(another) - set(keys) > return dict([[k, another[k]] for k in use if another[k] >= x] > > Though I still think I prefer the longhand version: > > out = dict() > for key in set(another) - set(keys): > if another[k] >= x: > out[k] = another[k] This is definitely better than the other long hand version as the set operation remove the potential problem of another[k] raise KeyError. -- http://mail.python.org/mailman/listinfo/python-list