At 02:14 PM 10/24/2007, bob gailer wrote:
Dick Moores wrote:
Please give me constructive criticism of < http://www.rcblue.com/Python/stopWatchForWeb14-a.py>
 
1 - lapCounter is not used.

Deleted.


2 - simplify:

               if lapTimeFlag == False:
                   print "Total Time is", secsToHMS(totalTime)
                   print "StopWatch is continuing to time.."
               else:
                   currentLapTime = markTime - lapEnd
                   print "Current time of this lap, Lap %d, is %s" % (lapNum, secsToHMS(currentLapTime))
                   print "Total Time is", secsToHMS(totalTime)
                   print "StopWatch is continuing to time.."

   new version:

               if lapTimeFlag:
                   currentLapTime = markTime - lapEnd
                   print "Current time of this lap, Lap %d, is %s" % (lapNum, secsToHMS(currentLapTime))
               print "Total Time is", secsToHMS(totalTime)
               print "StopWatch is continuing to time.."

Thanks. Missed that.

I'm wondering about "if lapTimeFlag:". Following "The Zen of Python", by Tim Peters ("Explicit is better than implicit"), isn't "if lapTimeFlag == True" preferable?

See the new revision < http://www.rcblue.com/Python/stopWatchForWeb14-b.py>

Dick
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to