The ole Repetion != Concatination pitfall

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Mon Apr 19 00:48:58 EDT 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()





-- 
Steven



More information about the Python-list mailing list