About 26,500,000 results
Open links in new tab
  1. Are Python sets mutable? - Stack Overflow

    Jan 7, 2013 · 14 Python sets are classified into two types. Mutable and immutable. A set created with 'set' is mutable while the one created with 'frozenset' is immutable.

  2. Append values to a set in Python - Stack Overflow

    Aug 2, 2010 · Converting to lists and back is a lot of unnecessary overhead and seems to defeat the purpose of sets. Consider the answer by @nyuszika7h as well as the solution in …

  3. python - Best way to find the intersection of multiple sets? - Stack ...

    5 Jean-François Fabre set.intesection (*list_of_sets) answer is definetly the most Pyhtonic and is rightly the accepted answer. For those that want to use reduce, the following will also work: …

  4. python - How do I add two sets? - Stack Overflow

    Apr 15, 2015 · c = a | b Sets are unordered sequences of unique values. a | b, or a.union(b), is the union of the two sets — i.e., a new set with all values found in either set. This is a class of …

  5. How can I create a Set of Sets in Python? - Stack Overflow

    152 Python's complaining because the inner set objects are mutable and thus not hashable. The solution is to use frozenset for the inner sets, to indicate that you have no intention of …

  6. Use curly braces to initialize a Set in Python - Stack Overflow

    36 From Python 3 documentation (the same holds for python 2.7): Curly braces or the set () function can be used to create sets. Note: to create an empty set you have to use set (), not {}; …

  7. In Python, when to use a Dictionary, List or Set?

    Jul 1, 2019 · 1 Dictionary: A python dictionary is used like a hash table with key as index and object as value. List: A list is used for holding objects in an array indexed by position of that …

  8. Union of multiple sets in python - Stack Overflow

    Jun 11, 2015 · Union of multiple sets in python Asked 10 years, 5 months ago Modified 3 years, 5 months ago Viewed 85k times

  9. python - How to join two sets in one line without using "|" - Stack ...

    Jul 2, 2013 · Assume that S and T are assigned sets. Without using the join operator |, how can I find the union of the two sets? This, for example, finds the intersection: S = {1 ...

  10. Efficiently compare two sets in Python - Stack Overflow

    Efficiently compare two sets in Python Asked 8 years, 2 months ago Modified 1 year, 9 months ago Viewed 86k times