[Tutor] Rotating an array?

Alan Gauld alan.gauld at btinternet.com
Sun Nov 19 23:46:31 CET 2006


"Alan Gauld" <alan.gauld at btinternet.com> wrote 
> If you just want an empty array as per Java you can use a
> list comprehension:
> 
> out = [[0] * 4 for n in range(4)]
> 

This isn't really empty of course, its full of zeros, the nearest 
to a truly empty array you can do in Python would be to use 
None for the value.

Sory for any confusion,

Alan G.




More information about the Tutor mailing list