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

Re: [pygame] Quick question from newbie



On 11/1/07, Michael George <mdgeorge@xxxxxxxxxxxxxx> wrote:

> Like has been said here before, use something like:
>
> if i <= 9 and i >= 1:
>
...and python is cool enough that you can just write

if 1 <= i <= 9:

and it does the right thing.

--Mike

If I recall correctly, the syntax

if 1 <= i <= 9

runs slower than the syntax

if i <= 9 and i >= 1

Somewhere around 10% slower.  If you use psyco, it goes about 40% slower!