This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients ezio.melotti, pitrou, rhettinger, serhiy.storchaka, vstinner, yaubi
Date 2014-07-29.01:45:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1406598343.4.0.753779564911.issue22097@psf.upfronthosting.co.za>
In-reply-to
Content
My current use case is manipulation of Numba IR code. I'm working on a transformation pass that adds instructions at arbitrary places in existing IR. The primitive I need is "add an instruction after another one" (which is exactly the insert_after() primitive proposed here :-)). Since Python lacks a linked list-like structure, my current solution is to use a regular list, meaning O(n) inserts.

(a tedious solution with a regular list would be lazy inserts and batching)

The code has nothing special but you can see it here:
https://github.com/pitrou/numba/blob/7538d4c96b64a19691c2f9b6ec894f777db1a996/numba/ir.py#L538

It may be argued that the general problem more has to do with the lack of a linked-list structure rather than ordereddict itself. However, I can't think of a nice plain linked-list API in Python, while the ordereddict abstraction is adequate.
History
Date User Action Args
2014-07-29 01:45:43pitrousetrecipients: + pitrou, rhettinger, vstinner, ezio.melotti, yaubi, serhiy.storchaka
2014-07-29 01:45:43pitrousetmessageid: <1406598343.4.0.753779564911.issue22097@psf.upfronthosting.co.za>
2014-07-29 01:45:43pitroulinkissue22097 messages
2014-07-29 01:45:43pitroucreate