The Python list comprehension syntax makes it easy to filter values within a comprehension. For example:
result = [x**2 for x in mylist if type(x) is int] <
You could always memoize the expensive() function so that calling it the second time around is merely a lookup for the computed value of x.
expensive()
x
Here's just one of many implementations of memoize as a decorator.