On 30/08/14 23:31, Bo Morris wrote:

time to a more appropriate amount. Anyone see any issues with it or ways
to make it better?

One obvious issue:

while True:
     while count < 15:
         for line in p.stderr:
>              if  "Segmentation" in line:
                 while restart < 3:
                     for line in p.stderr:
             if "storing 0x" in line:
                 while restart < 3:
                     for line in p.stderr:
                         print line
         if count == 15:
             break
     break

First, there are a lot of embedded loops in there, that's usually a design warning that maybe you need to look at things again. In particular I'm suspicious of those two "for line in p.stderr" loops
inside a loop that is itself a "for line in p.stderr" loop.
That feels wrong. I haven't worked through the detail so it
might be valid but it smells bad to me.
Looking closer, you are reassigning p in the middle of a loop that depends on p. That's usually not a good idea...

Second, the last break does nothing except terminate the outer loop after the first time through. So you might as well miss out the
initial "while True" line...

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to