New submission from Diego Argueta <diego.argu...@gmail.com>: 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. ---------- components: Library (Lib) messages: 317250 nosy: da priority: normal severity: normal status: open title: Support heapq on typed arrays? type: enhancement versions: Python 2.7, Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33593> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com