Python Forum

Full Version: comprehension for sets
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
is there a way to create a populated set in a comprehension without creating a list ahead of it? my iterator for the comprehension is a generator.
Yes there are set comprehensions. See the docs.
ah, i was searching the docs for it by how i thought it would be done.