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

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



Frank,
As it turned out, the FPS dropped when I changed from dict to array of arrays
(possibly 'cos only 10 or so key values but array 200 long... so
overhead of testing array is big and similar to dict key lookup).

p.

Frank Raiser wrote:

> On Fri, Sep 07, 2001 at 12:09:33PM +0100, Peter Goode wrote:
>
> > Now I see how it's happening... but...
> > I do question why, given that [] is empty you'd have to be a bit wierd
> > to want the DUP operator (*) to be
> > creating a list of references to the same array
> It doesn't matter what value is in your list. It's generally a feature and
> one of the few places a python newcomer might have problems with. Therefore
> it's covered in the Python FAQ: http://python.org/doc/FAQ.html#4.50
>
> > QUESTION
> > Is there any syntactical sugar I can use to force * to create a new
> > empty list for each element ????
> No legal way to change the syntax and thereby internal working of *. A way
> to get your multidimensional array done can be found at the above webpage.
>
> > SUPPLEMENTARY QUESTION (bonus point!)
> > Can anyone direct me to a good Python website for experienced
> > programmers, i.e. I know C++/Java/Assembler/Perl/Pascal
> > but need to know the syntax wierdities of Python.
> There aren't many syntax weirdos really. Mose of those are covered in the FAQ
> with optional 'workarounds for unexpected behavior' :)
> Other than that I may recommend comp.lang.python.. although it's creating ways
> too much traffic for my personal taste (last time I checked there were about
> 800-1000 messages daily)
>
> --
> Raiser, Frank aka CrashChaos
> IRC: 141.30.225.9:6667 #United-Programmers
>
> "A mathematician is a blind man in a dark room looking for a black cat
> which isn't there."                -- Charles Darwin
> ____________________________________
> pygame mailing list
> pygame-users@seul.org
> http://pygame.seul.org

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