Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
comprehension for sets
#1
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Yes there are set comprehensions. See the docs.
Reply
#3
ah, i was searching the docs for it by how i thought it would be done.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Peculiar pattern from printing of sets SahandJ 7 1,862 Dec-29-2021, 06:31 PM
Last Post: bowlofred
  How does one combine 2 data sets ? detlefschmitt 2 1,788 Sep-03-2021, 03:38 AM
Last Post: detlefschmitt
  Looping Through Large Data Sets JoeDainton123 10 4,678 Oct-18-2020, 02:58 PM
Last Post: buran
  Sort sets by item values Sergey 4 95,728 Apr-19-2019, 10:50 AM
Last Post: Sergey
  Problem with character sets Pedroski55 4 3,947 Mar-04-2019, 02:35 AM
Last Post: snippsat
  merge 3 sql data sets to 1 librairy brecht83 0 2,192 Sep-26-2018, 10:13 PM
Last Post: brecht83
  Sets and Lists mp3909 2 2,549 Feb-21-2018, 11:54 AM
Last Post: mp3909

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020