The ol' [[]] * 500 bug...

Ulrich Eckhardt doomster at
Sat Nov 14 16:13:08 CET 2009

Diez B. Roggisch wrote:
> kj schrieb:
>>   lol = [[] for _ in xrange(500)]
> If you call that hideous, I suggest you perform the same exercise in
> Java or C++ - and then come back to python and relax....

I might be missing something that's not explicitly mentioned here, but I'd 
say that all non-associative containers in C++ have a resize() method, some 
even taking an initial size in their constructor.

That said, [[]]*500 is IMHO more readable.


More information about the Python-list mailing list