The ole Repetion != Concatination pitfall

Steven D'Aprano steven at
Mon Apr 19 06:48:58 CEST 2010

On Sun, 18 Apr 2010 17:34:03 -0700, JChG wrote:

> But I'll still whine anyway...I'm not seeing where list repetition is
> particularly useful, except when you want independent objects, like my
> initialization of sieve above.

Or when the objects are immutable, like ints, strings or None.

pre_allocated = [None]*100
while condition:
    i = get_index()
    pre_allocated[i] = get_result()


More information about the Python-list mailing list