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

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



Right... That would work for any array data type initialisation, even structured
data wouldn't it (not with Numeric obviously)

Jiba wrote:

> 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

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