Re: advice on this little script

2006-04-08 Thread R. Bernstein
"BartlebyScrivener" <[EMAIL PROTECTED]> writes: > There are several of these writing quotes, all good in their own way, And from Hamlet: brevity is the soul of wit. -- http://mail.python.org/mailman/listinfo/python-list

Re: advice on this little script

2006-03-09 Thread Terry Reedy
"John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ben Cartwright wrote: >> BartlebyScrivener wrote: >>> What about a console beep? How do you add that? >>> >>> rpd >> >> Just use ASCII code 007 (BEL/BEEP): >> >> >>> import sys >> >>> sys.stdout.write('\007') >> >> O

Re: advice on this little script

2006-03-09 Thread Carl Banks
John Salerno wrote: > John Salerno wrote: > > > from time import sleep > ... > > sleep(1.0) > > Very picky point, but I'd like to know what others think of this. Should > I import as above, or should I do this: > > import time > > time.sleep(60.0) ??? > > I think the 'from time import sl

Re: advice on this little script

2006-03-09 Thread BartlebyScrivener
>>You might also want to synchronize to a caesium clock, but the guy is timing his laundry, << My morning coffee just streamed out of my nose. Air. I need air. rpd -- http://mail.python.org/mailman/listinfo/python-list

Re: advice on this little script

2006-03-09 Thread BartlebyScrivener
There are several of these writing quotes, all good in their own way, because they emphasize concision as the first order of business for any writer. "If I had more time, I would write a short letter."--Blaise Pascal "If the author had been less industrious, this book would be twice as long."--Ev

Re: advice on this little script

2006-03-09 Thread John Salerno
Alex Martelli wrote: > I'm hardly new to Python, yet it keeps helping me too;-). Yeah, from what I hear and read, you know a thing or two about the language. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: advice on this little script

2006-03-09 Thread Alex Martelli
John Salerno <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > I only use the 'from' statement to import specific modules from a > > package, never to import specific objects (functions, classes, or > > whatever) from a module. > > I like that. So in my case I'd use 'import time' (which I

Re: advice on this little script

2006-03-09 Thread Alex Martelli
Kent Johnson <[EMAIL PROTECTED]> wrote: ... > If you use from xx import yy, searching for yy will show you its > provenance as well. But when seeing the barename yy, it gives no clue whether the module you're reading used 'from xx import yy' or defined yy in any other way (localy, globally, or

Re: advice on this little script

2006-03-09 Thread John Salerno
Alex Martelli wrote: > I only use the 'from' statement to import specific modules from a > package, never to import specific objects (functions, classes, or > whatever) from a module. I like that. So in my case I'd use 'import time' (which I actually already changed last night). I think especial

Re: advice on this little script

2006-03-09 Thread John Salerno
Steve Holden wrote: > You might also want to synchronize to a caesium clock, but the guy is > timing his laundry, for Pete's sake! Can we agree your approach, while > theoretically sound, might be a little over-complicated for a first > application? LOL. Thanks, I was about to fall out of my c

Re: advice on this little script

2006-03-09 Thread Grant Edwards
On 2006-03-09, John Salerno <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2006-03-09, John Salerno <[EMAIL PROTECTED]> wrote: >> >>> from time import sleep >>> >>> minutes = input('Enter the number of minutes to wait: ') >>> >>> for x in range(minutes): >>> sleep(1.0) >>> minutes

Re: advice on this little script

2006-03-09 Thread Kent Johnson
Alex Martelli wrote: > John Salerno <[EMAIL PROTECTED]> wrote: >... > >>I think the 'from time import sleep' looks cleaner, because I'm only >>taking what I need (is an import any more expensive than this from?), >>but I also feel like the 'time.sleep' syntax is much more >>self-describing a

Re: advice on this little script

2006-03-08 Thread Steve Holden
Paul Rubin wrote: > John Salerno <[EMAIL PROTECTED]> writes: > >>>for x in range(minutes,0,-1): >>>sleep(60.0) >>>print minutes, 'minutes remaining' >>> >> >>Nice! Cross off another line! I feel like Hemingway. :) > > > Besides the bug mentioned, I don't think you should really do it th

Re: advice on this little script

2006-03-08 Thread Alex Martelli
John Salerno <[EMAIL PROTECTED]> wrote: ... > I think the 'from time import sleep' looks cleaner, because I'm only > taking what I need (is an import any more expensive than this from?), > but I also feel like the 'time.sleep' syntax is much more > self-describing and better to read than just

Re: advice on this little script

2006-03-08 Thread Alex Martelli
Grant Edwards <[EMAIL PROTECTED]> wrote: ... > > Nice! Cross off another line! I feel like Hemingway. :) > > Was he the one who once apologized to his editor for a story > being so long because he was in a hurry and didn't have time to > make it shorter? Nope, that immortal quote is by Blaise

Re: advice on this little script

2006-03-08 Thread Paul Rubin
John Salerno <[EMAIL PROTECTED]> writes: > > for x in range(minutes,0,-1): > > sleep(60.0) > > print minutes, 'minutes remaining' > > > Nice! Cross off another line! I feel like Hemingway. :) Besides the bug mentioned, I don't think you should really do it that way, since sleep(60.0) migh

Re: advice on this little script

2006-03-08 Thread John Salerno
James Stroud wrote: > John Salerno wrote: >> Grant Edwards wrote: >> >>> On 2006-03-09, John Salerno <[EMAIL PROTECTED]> wrote: >>> from time import sleep minutes = input('Enter the number of minutes to wait: ') for x in range(minutes): sleep(1.0) minutes

Re: advice on this little script

2006-03-08 Thread Benjamin Liebald
John Salerno wrote: >> for x in range(minutes,0,-1): >> sleep(60.0) >> print minutes, 'minutes remaining' >> > > I might be doing something wrong, but this just keeps printing out '10 > minutes remaining' each time. should be: for x in range(minutes,0,-1): sleep(60.0) print x,

Re: advice on this little script

2006-03-08 Thread James Stroud
John Salerno wrote: > Grant Edwards wrote: > >> On 2006-03-09, John Salerno <[EMAIL PROTECTED]> wrote: >> >>> from time import sleep >>> >>> minutes = input('Enter the number of minutes to wait: ') >>> >>> for x in range(minutes): >>> sleep(1.0) >>> minutes -= 1 >>> print minutes, 'min

Re: advice on this little script

2006-03-08 Thread John Salerno
Ben Cartwright wrote: > BartlebyScrivener wrote: >> What about a console beep? How do you add that? >> >> rpd > > Just use ASCII code 007 (BEL/BEEP): > > >>> import sys > >>> sys.stdout.write('\007') > > Or if you're on Windows, use the winsound standard module. > > --Ben > I'd prefer to

Re: advice on this little script

2006-03-08 Thread John Salerno
Grant Edwards wrote: > On 2006-03-09, John Salerno <[EMAIL PROTECTED]> wrote: > >> from time import sleep >> >> minutes = input('Enter the number of minutes to wait: ') >> >> for x in range(minutes): >> sleep(1.0) >> minutes -= 1 >> print minutes, 'minutes remaining.' > > for x in

Re: advice on this little script

2006-03-08 Thread John Salerno
Grant Edwards wrote: > Was he the one who once apologized to his editor for a story > being so long because he was in a hurry and didn't have time to > make it shorter? Hmm, not sure. He doesn't seem like the type to apologize, or even have long stories. :) He was ruthless with his edits, that'

Re: advice on this little script

2006-03-08 Thread Grant Edwards
On 2006-03-09, John Salerno <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2006-03-09, John Salerno <[EMAIL PROTECTED]> wrote: >> >>> from time import sleep >>> >>> minutes = input('Enter the number of minutes to wait: ') >>> >>> for x in range(minutes): >>> sleep(1.0) >>> minutes

Re: advice on this little script

2006-03-08 Thread Ben Cartwright
BartlebyScrivener wrote: > What about a console beep? How do you add that? > > rpd Just use ASCII code 007 (BEL/BEEP): >>> import sys >>> sys.stdout.write('\007') Or if you're on Windows, use the winsound standard module. --Ben -- http://mail.python.org/mailman/listinfo/python-list

Re: advice on this little script

2006-03-08 Thread John Salerno
John Salerno wrote: > from time import sleep ... > sleep(1.0) Very picky point, but I'd like to know what others think of this. Should I import as above, or should I do this: import time time.sleep(60.0) ??? I think the 'from time import sleep' looks cleaner, because I'm only tak

Re: advice on this little script

2006-03-08 Thread John Salerno
Grant Edwards wrote: > On 2006-03-09, John Salerno <[EMAIL PROTECTED]> wrote: > >> from time import sleep >> >> minutes = input('Enter the number of minutes to wait: ') >> >> for x in range(minutes): >> sleep(1.0) >> minutes -= 1 >> print minutes, 'minutes remaining.' > > for x in

Re: advice on this little script

2006-03-08 Thread John Salerno
BartlebyScrivener wrote: > What about a console beep? How do you add that? > > rpd > Ooh, good point! I forgot about the most important part, otherwise I'd never know it was done and someone would steal my clothes! :) Time to do some library reference research -- http://mail.python.org/m

Re: advice on this little script

2006-03-08 Thread John Salerno
James Stroud wrote: > Very nice, but maybe > > ... >sleep(60.0) > > This corrects for the number of seconds in a minute. > > James > Thanks! And yeah, I fixed that little issue. If only laundry could be done that fast. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: advice on this little script

2006-03-08 Thread Grant Edwards
On 2006-03-09, John Salerno <[EMAIL PROTECTED]> wrote: > from time import sleep > > minutes = input('Enter the number of minutes to wait: ') > > for x in range(minutes): > sleep(1.0) > minutes -= 1 > print minutes, 'minutes remaining.' for x in range(minutes,0,-1): sleep(60.

Re: advice on this little script

2006-03-08 Thread BartlebyScrivener
What about a console beep? How do you add that? rpd -- http://mail.python.org/mailman/listinfo/python-list

Re: advice on this little script

2006-03-08 Thread James Stroud
John Salerno wrote: > My first project when I started learning C# was to make a little timer > to tell me when my laundry was done :) and I thought it would be fun to > convert this to Python. Here's what I came up with after much struggling > with the Timer class from the threading module -- as

Re: advice on this little script

2006-03-08 Thread John Salerno
John Salerno wrote: > sleep(1.0) Heh heh, that was for testing. Obviously it should read 60.0 (is a float necessary at all?). -- http://mail.python.org/mailman/listinfo/python-list

advice on this little script

2006-03-08 Thread John Salerno
My first project when I started learning C# was to make a little timer to tell me when my laundry was done :) and I thought it would be fun to convert this to Python. Here's what I came up with after much struggling with the Timer class from the threading module -- as you can see, I abandoned i