[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] python newbie question re. arrays of arrays



Peter Goode :
> Hi there

Hi

> QUESTION
> Is there any syntactical sugar I can use to force * to create a new
> empty list for each element ????
> 
> I've tried looking in "Programming Python" and a bit online.
> I can just force the code to do what I want for now with the rather ugly
> 
>     blitbits = []
>     for bb in range(MAPF_MASK_HEIGHT):
>         blitbits.append([])

blitbits = map(lambda x: [], xrange(MAPF_MASK_HEIGHT))

I think it may be faster than the "for" - especially for big list. (Not tested)

Jiba
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org