[Tutor] Unit testing infinite loops

spir denis.spir at gmail.com
Fri Jan 31 13:10:03 CET 2014


On 01/31/2014 12:31 PM, James Chapman wrote:
> try:
>      while self.attribute:
>          time.sleep(1)
> except KeyboardInterrupt:

Maybe I'm missing apoint or reasoning wrongly, but I'd rather do:

while self.attribute:
    try:
         time.sleep(1)
    except KeyboardInterrupt:

... or something like that however, (I don't know whether one can interrupt 
while sleeping)

d


More information about the Tutor mailing list