[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Pygame Scene System



nikwin wrote:

- Secondly, when I look through the code, in every function I see
attribute accesses being referenced locally for speed (eg;
surface_blit=surface.blit, spritedict=self.spritedict). When writing,
should I adopt the same style? Or can I program directly, which I feel
is more readable?

> - In a related point, instead of using hasattr, can I use try ...
> except, or in the case of _spritegroup isinstance?

The usual advice applies -- profile first, optimise later.
Write it whatever way you find to be clearest. If the speed
of that piece of code turns out to be a problem, then you
can change it.

--
Greg