Message317250
It'd be really great if we could have support for using the `heapq` module on typed arrays from `array`. For example:
```
import array
import heapq
import random
a = array.array('I', (random.randrange(10) for _ in range(10)))
heapq.heapify(a)
```
Right now this code throws a TypeError:
TypeError: heap argument must be a list
I suppose I could use `bisect` to insert items one by one but I imagine a single call to heapify() would be more efficient, especially if I'm loading the array from a byte string.
From what I can tell the problem lies in the C implementation, since removing the _heapq imports at the end of the heapq module (in 3.6) makes it work. |
|
Date |
User |
Action |
Args |
2018-05-21 21:11:04 | da | set | recipients:
+ da |
2018-05-21 21:11:04 | da | set | messageid: <1526937064.06.0.682650639539.issue33593@psf.upfronthosting.co.za> |
2018-05-21 21:11:04 | da | link | issue33593 messages |
2018-05-21 21:11:03 | da | create | |
|