Error occurs in the following code, and we can't see the source code or debug into it.
I wonder
- the real reason PriorityQueue(or heapq) works inner;
- how to solve this phenomenon.
import numpy as np
from queue import PriorityQueue
q = PriorityQueue()
q.put((0, np.array([True, True])))
q.put((0, np.array([True, False])))
"""
Traceback (most recent call last):
File "D:/code-study/py/A/B.py", line 6, in <module>
q.put((0, np.array([True, False])))
File "D:\ProgramData\Anaconda3\lib\queue.py", line 149, in put
self._put(item)
File "D:\ProgramData\Anaconda3\lib\queue.py", line 233, in _put
heappush(self.queue, item)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
"""