Use frozenset,
>>> set([frozenset([1,2]), frozenset([2,3])]) set([frozenset([1, 2]), frozenset([2, 3])])
To represent a set of sets, the inner sets must be frozenset objects for the reason that the elements of a set must be hashable (all of Python’s immutable built-in objects are hashable). frozenset is immutable and set is mutable.
Related Posts:
- Add list to set?
- Python set to list
- Remove list from list in Python
- TypeError: unsupported operand type(s) for -: ‘list’ and ‘list’
- Python Sets vs Lists
- Inorder Binary Tree Traversal (using Python)
- In Python, when to use a Dictionary, List or Set?
- Type error Unhashable type:set
- How to make a set of lists
- How to obtain a subarray in python 3
- Get difference between two lists
- How can I reverse a list in Python?
- Difference between del, remove, and pop on lists
- How can I reverse a list in Python?
- What is the difference between Python’s list methods append and extend?
- Python – TypeError: ‘int’ object is not iterable
- TypeError: ‘int’ object is not subscriptable
- Understanding slice notation
- Understanding slice notation
- TypeError: list indices must be integers or slices, not str
- IndexError: list index out of range and python
- Python – TypeError: ‘int’ object is not iterable
- How to convert list to string [duplicate]
- How do I get the number of elements in a list?
- What is the result of % in Python?
- Reading an Excel file in python using pandas
- Difference between del, remove, and pop on lists
- Error: ‘int’ object is not subscriptable – Python
- How to overcome TypeError: unhashable type: ‘list’
- Python Variable Declaration
- How do I compare two strings in python?
- TypeError: ‘int’ object is not callable
- Finding the index of an item in a list
- TypeError: ‘int’ object is not callable
- Finding the index of an item in a list
- Accessing the index in ‘for’ loops?
- working of \n in python [duplicate]
- Pip freeze vs. pip list
- How to make a flat list out of a list of lists
- Removing duplicates in lists
- TypeError: ‘int’ object is not callable
- Accessing the index in ‘for’ loops?
- What does the list() function do in Python?
- List changes unexpectedly after assignment. Why is this and how can I prevent it?
- Why does this iterative list-growing code give IndexError: list assignment index out of range?
- Cannot find module cv2 when using OpenCV
- Cannot find module cv2 when using OpenCV
- Append values to a set in Python
- Python ‘If not’ syntax [duplicate]
- RuntimeWarning: invalid value encountered in divide
- TypeError: ‘float’ object is not subscriptable
- Converting dictionary to JSON
- Is there a short contains function for lists?
- TypeError: ‘float’ object is not subscriptable
- Transpose/Unzip Function (inverse of zip)?
- appending list but error ‘NoneType’ object has no attribute ‘append’
- WinError 2 The system cannot find the file specified (Python)
- IndexError: tuple index out of range —– Python
- Check if something is (not) in a list in Python
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- Python: finding an element in a list [duplicate]
- How to avoid “RuntimeError: dictionary changed size during iteration” error?
- TypeError: cannot perform reduce with flexible type
- Could not find a version that satisfies the requirement tensorflow
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- How to avoid “RuntimeError: dictionary changed size during iteration” error?
- Could not find a version that satisfies the requirement tensorflow
- Local variable referenced before assignment?
- ln (Natural Log) in Python
- Finding the average of a list
- Writing a list to a file with Python
- How to uninstall Python 2.7 on a Mac OS X 10.6.4?
- How do I concatenate two lists in Python?
- if else in a list comprehension
- Does Python have an ordered set?
- ImportError: numpy.core.multiarray failed to import
- How can I randomly select an item from a list?
- Print a list in reverse order with range()?
- Convert Set to List without creating new List
- Get unique values from a list in python [duplicate]
- Python Traceback (most recent call last)
- Fastest way to check if a value exists in a list
- python pip – install from local dir
- How can I count the occurrences of a list item?
- Unable to plot Double Bar, Bar plot using pyplot for ndarray
- How to pip or easy_install tkinter on Windows
- TypeError: ‘list’ object cannot be interpreted as an integer
- Why is it string.join(list) instead of list.join(string)?
- Why is it string.join(list) instead of list.join(string)?
- Cannot find module cv2 when using OpenCV
- How do I concatenate two lists in Python?
- if else in a list comprehension
- Does Python have an ordered set?
- pip or pip3 to install packages for Python 3?
- Finding median of list in Python
- Convert list to tuple in Python
- ImportError: numpy.core.multiarray failed to import
- Python List vs. Array – when to use?
- How to find all occurrences of an element in a list