"or else", that's a good way of reading it, thanks. On Thu, Jan 29, 2009 at 1:27 AM, Bill Coderre <b...@mac.com> wrote: > Interestingly, one rarely sees people use "and" as an idiom. It will execute > starting with the left-most statement, and keep going until one of them > fails, then stop, executing nothing further. So you could read it as "and > then" >
Well, you often see things like: enemy = FindClosestEnemy() if enemy and enemy.can_attack(self): self.pair_off_with(enemy) else: self.flail_around_madly() ... though it isn't really the "and" idiom you're talking about. That would be more like: self.attacked_this_turn = enemy and self:attack(enemy) ... which is indeed rather rare (rightfully so) Emile