[Python-ideas] List Revolution

Steven D'Aprano steve at pearwood.info
Mon Sep 12 12:41:17 CEST 2011

Steven D'Aprano wrote:

> item = mylist[7-5]
> and so we can simulate variable-offset indexing with no new syntax and 
> only a very small run-time cost.

Oh, I forgot to mention... if both values are literals, as in the 
example above, there may not even be a run-time cost. CPython's 
peek-hole optimizer will compile it to mylist[2].


More information about the Python-ideas mailing list