This is a set comprehension, not a dict comprehension, so you need set(..), not dict(...)