On Mar 28, 10:21 am, Steve Howell <showel...@yahoo.com> wrote: > import timeit > M = 10 > N = 8000 > > def in_place( > start = [], > sublists = ([[None] * M]) * N > ): > # only macro-optimized > i = 0 > for sublist in sublists: > if i == 0: > accum = start + sublist > i += 1 > else: > accum.extend(sublist)
FYI I later obtained similar results with the more general: accum += sublist > if i == 0: > return 'whatever' # semantics here? > return accum > > def with_intermediates( > start = [], > sublists = ([[None] * M]) * N > ): > accum = start > for sublist in sublists: > accum = accum + sublist > return accum > -- http://mail.python.org/mailman/listinfo/python-list