On 12/12/2013 12:25, Chris Angelico wrote:
On Thu, Dec 12, 2013 at 11:08 PM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
P.S. The algorithm I'm working on is a way of generating index and rank
tables. Not that it really matters -- what matters is determining whether
or not to shift from "make a copy of the list" to "modify the list in
place".

So you're currently looking at...

if len(table) < ?????:
     table = [i for x,i in table]
else:
     for x, i in table:
         table[i] = x


Can I throw a spanner [1] in the works with other suggestions to try timing?

table[:] = [i for x,i in table]  # Does slice assignment get optimized?

[snip]

If you're trying that, you could also try:

table[:] = (i for x,i in table)

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to