Bart> I'm sorry, but what's wrong with:
Bart> radix = [ [] ] * 256
Follow it up with:
print [id(e) for e in radix]
then you tell me what's wrong with it. ;-)
Skip
--
http://mail.python.org/mailman/listinfo/python-list
En Fri, 09 Mar 2007 18:35:59 -0300, Bart Willems <[EMAIL PROTECTED]>
escribió:
> I'm sorry, but what's wrong with:
> radix = [ [] ] * 256
http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list
http://www.python.org/doc/faq/general.html#why-are-default-values-shar
I'm sorry, but what's wrong with:
radix = [ [] ] * 256
Cheers,
Bart
"John" writes:
>> For my code of radix sort, I need to initialize 256 buckets. My code looks a
>> little clumsy:
>>
>> radix=[[]]
>> for i in range(255):
>> radix.append([])
>>
>> any better code to initalize this list?
>>