Thanks Kent, and Evert, and everyone,
I really appreciate the advice on etiqutte and all
your help. I will think through my questions much more
thoroughly before any further inquiries and will
'reply to all' as advised.
--- Kent Johnson <[EMAIL PROTECTED]> wrote:
> ted b wrote:
>
> > Here's the code i am using, but its a lot of if /
> > thens and i'm trying to find a better way:
> >
> > if var1.value > var2.value > var3.value:
> > objSprites = pygame.sprite.OrderedUpdates
> > (var1, var2, var3)
>
> Did you see Evert's reply to your original question?
> It was pretty close
> to the mark. Though you had not said anything about
> the .value
> attributes until now.
>
> Try this:
> from operator import attrgetter
> vars = [ var1, var2, var3 ]
> vars.sort(key=attrgetter('value'))
> objSprites = pygame.sprite.OrderedUpdates(*vars)
>
> This will sort the vars list by the value attribute
> of each list item,
> then pass the list as the parameter list to
> OrderedUpdates().
>
> Kent
>
> PS Please use Reply All to reply to the list.
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor