[Tutor] break
Dave Angel
davea at davea.name
Fri Mar 15 02:21:09 CET 2013
On 03/14/2013 07:23 PM, Matthew Ngaha wrote:
>>> if Enemy.ships:
>>> for missile in self.missiles:
>>
>> flag = False
>>>
>>> for rect in Enemy.rects:
>>
>> assert(!flag)
>>
>>> if QPoint(missile.x + 5, missile.y) in rect:
>>> explosion = Explosion(rect.x(), rect.y())
>>> self.explosions.append(explosion)
>>
>> flag = True
>>>
>>> break
>
> im about to try the suggestions. i on python 3 and this line is giving
> me a syntax error assert(!flag).
>
>
My mistake. The exclamation point is from C. In Python, it should be "not"
assert(not flag)
This statement simply asserts (claims) that flag is NOT TRUE, and if for
some reason it is true, it throws an exception.
--
DaveA
More information about the Tutor
mailing list