itertools has functions that make that sort of nesting unnecessary (and some would say make the code clearer), eg:
import itertools as it
[f(a, b) for a, b in it.product(some_list, some_list) if a is not b]