preserve compatibility with python 2.6

cbay reported that set comprehension was available only in python 2.7+.
This patch fixes the syntax to keep backward compatibility with python 2.6.