Finding perimeters of right triangles with integer-length legs, up to a limit
You can rewrite it with two separate comprehensions.  One to generate the values and one to filter them out.  You can use itertools.product to get the cartesian product.

a = [x for x in (i + j + (i**2 + j**2)**0.5
                 for i, j in itertools.product(range(1, limit+1), repeat=2))
     if x &lt;= limit]