You'd use iteration, list comprehensions or generators and the itertools
module:
from itertools import product, islice
# all values, generator expression
query = ((x['val'], y['val']) for x, y in product(R, S) if x['id'] == y['id'])
# just the first 10
limited = islice(query, 10)
for row in limited:
print row