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

Re: [pygame] Name self not defined



The "or" operator is what they call a "short circuiting" operator. If 
the first part is True then the second part is never evaluated. If the 
first part is False, then the second part is returned.

---
James

On Wed, Jan 28, 2009 at 04:03:27PM -0800, Yanom Mobis wrote:
>    how do you use the or statement in arguments?                  
>    i have never seen it done.                                     
>                                                                   
>    --- On Wed, 1/28/09, Ian Mallett <geometrian@xxxxxxxxx> wrote: 
>                                                                   
>      From: Ian Mallett <geometrian@xxxxxxxxx>                     
>      Subject: Re: [pygame] Name self not defined                  
>      To: pygame-users@xxxxxxxx                                    
>      Date: Wednesday, January 28, 2009, 4:25 PM                   
>                                                                   
>      Frankly, I like this solution:                               
>      self.rect = self.rect.move(speedv or (0,0))                  
>      Looks Pythonic to me.