Just try it:
>>> hash((1,2,3)) 2528502973977326415 >>> hash([1,2,3]) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'list' >>> hash(frozenset((1,2,3))) -7699079583225461316 >>> hash(set((1,2,3))) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'set'
So you can get hash
of tuple
and frozenset
since the are immutable, and you can’t do it for list
and set
because they are mutable.
Related Posts:
- How to declare an array in Python?
- TypeError: list indices must be integers or slices, not str
- ValueError: setting an array element with a sequence
- TypeError: only size-1 arrays can be converted to Python scalars (matplotlib)
- Is a Python dictionary an example of a hash table?
- Numpy ValueError: setting an array element with a sequence. This message may appear without the existing of a sequence?
- numpy: Invalid value encountered in true_divide
- How do I create an empty array/matrix in NumPy?
- ValueError: operands could not be broadcast together with shapes (5,) (30,)
- numpy matrix vector multiplication
- hashlib.md5() TypeError: Unicode-objects must be encoded before hashing
- What does hash do in python?
- Convert pandas dataframe to NumPy array
- TypeError: unhashable type: ‘dict’, when dict used as a key for another dict
- size of NumPy array
- Python List vs. Array – when to use?
- ValueError: all the input arrays must have same number of dimensions
- How to find list intersection?
- ValueError: setting an array element with a sequence
- Using Numpy Vectorize on Functions that Return Vectors
- Is arr.__len__() the preferred way to get the length of an array in Python?
- Is there a NumPy function to return the first index of something in an array?
- Numpy/Python Array Value error
- Python: Array v. List
- initialize a numpy array
- load csv into 2D matrix with numpy for plotting
- How to access the ith column of a NumPy multidimensional array?
- Dump a NumPy array into a csv file
- Python: find position of element in array
- numpy with python: convert 3d array to 2d
- Create 3D array using Python
- Python: slicing a multi-dimensional array
- Shuffle an array with python, randomize array item order with python
- How do I get an empty array of any size in python?
- How to remove specific elements in a numpy array
- TypeError: list indices must be integers or slices, not str
- Add single element to array in numpy
- Python: Write array values into file
- How to create an array of bits in Python?
- How to have an array of arrays in Python
- How to normalize a 2-dimensional numpy array in python less verbose?
- Make list of arrays in python
- Understanding NumPy’s einsum
- How to read a text file into a list or an array with Python
- Python Array Rotation
- How can I create an array/list of dictionaries in python?
- How to fix “TypeError: len() of unsized object”
- TypeError: Invalid dimensions for image data when plotting array with imshow()
- Numpy.dot TypeError: Cannot cast array data from dtype(‘float64’) to dtype(‘S32’) according to the rule ‘safe’
- How to get the unit vector from a numpy array
- Python: Can a function return an array and a variable?
- How to create an integer array in Python?
- numpy-equivalent of list.pop?
- Using numpy to build an array of all combinations of two arrays
- Efficiently sorting a numpy array in descending order?
- How to plot an array in python?
- TypeError: only integer arrays with one element can be converted to an index 3
- How to create a numpy array of all True or all False?
- How to create a numpy array of lists?
- Removing nan values from an array
- Root mean square of a function in python
- What are the differences between numpy arrays and matrices? Which one should I use?
- Numpy – add row to array
- Is there any numpy group by function?
- How do I merge lists in python? [duplicate]
- Counting array elements in Python
- Mean Squared Error in Numpy?
- How to normalize a NumPy array to within a certain range?
- numpy array concatenation error: 0-d arrays can’t be concatenated
- Convert a 1D array to a 2D array in numpy
- inverting image in Python with OpenCV
- How to print the full NumPy array, without truncation?
- Sorting arrays in NumPy by column
- How is Python’s List Implemented?
- Can I put a tuple into an array in python?
- Shuffle an array with python, randomize array item order with python
- Manually raising (throwing) an exception in Python
- Importing modules from parent folder
- Could not find a version that satisfies the requirement tensorflow
- How do you do natural logs (e.g. “ln()”) with numpy in Python?
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- What is print(f”…”)
- Pandas how to use pd.cut()
- What is the difference between list and list[:] in python?
- How to Read .txt in Pandas
- Why am I getting AttributeError: Object has no attribute?
- OSError [Errno 22] invalid argument when use open() in Python
- SBOX_FATAL_MEMORY_EXCEEDED error shown when Chromedriver turned 1800-1900 pages using Selenium
- Displaying better error message than “No JSON object could be decoded”
- How do I check if a string is a number (float)?
- ‘pip install’ fails for every package (“Could not find a version that satisfies the requirement”) [duplicate]
- Python multiprocessing.Pool: AttributeError
- Convert string to ASCII value python
- Python 3.6 import requests
- Tensorflow 2.0 – AttributeError: module ‘tensorflow’ has no attribute ‘Session’
- What is key=lambda
- Extract a part of the filepath (a directory) in Python
- Can’t concat bytes to str
- Iterating over dictionary items(), values(), keys() in Python 3
- ValueError: insecure string pickle