Re: [Tutor] Sleeping it out

2007-12-08 Thread Ricardo Aráoz
Alan Gauld wrote: > "Eric Brunson" <[EMAIL PROTECTED]> wrote > >> Yes, import sys, then sys.stdout.flush() when you need it. > > This was my initial idea but it doesn't work in the IDE because > it is not really using sys.stdout. In fact the normal print works > fine from the command prompt (at l

[Tutor] Timed While Loops and Threads

2007-12-08 Thread Michael H. Goldwasser
Hi everyone, I'm having some fun combining two recent topics: the "Timed While Loops" game and that of communication between threads. Here is an example that allows a person to gather points in a while loop, but only for a fixed period of time. It relies on a few shared variables to coordinate

[Tutor] Newbie to Python

2007-12-08 Thread Fred P
Hey everyone, New to python, but not so scripting. Have some experience with C++, but more experience with LUA, CShell, and other types of scripting similar to those. I want to learn Python, and I have decided I would like my first project to be a collection program. I would like to provi

Re: [Tutor] Beat me over the head with it

2007-12-08 Thread Rob Andrews
Need help with a motivational disorder? ;) When you say you want to learn Python, what's the nature of the "want to" part? Looking to write a game, land a job, parse a log file? Perhaps if you focus on what it is you want to do, that will lead the way. On Dec 8, 2007 9:08 PM, Theyain <[EMAIL PRO

[Tutor] Beat me over the head with it

2007-12-08 Thread Theyain
I'm not sure if this is really the place to do this, but I will ask anyways. Hello everyone, names Theyain. I want to learn Python. But I am one of those people who needs some one to "Beat me over the head" to actually learn something. I can't get myself to actually sit down and read a tutor

Re: [Tutor] Sleeping it out

2007-12-08 Thread Eric Brunson
Alan Gauld wrote: > "Eric Brunson" <[EMAIL PROTECTED]> wrote > > >> Yes, import sys, then sys.stdout.flush() when you need it. >> > > This was my initial idea but it doesn't work in the IDE because > it is not really using sys.stdout. In fact the normal print works > fine from the command p

Re: [Tutor] Sleeping it out

2007-12-08 Thread Alan Gauld
"Eric Brunson" <[EMAIL PROTECTED]> wrote > Yes, import sys, then sys.stdout.flush() when you need it. This was my initial idea but it doesn't work in the IDE because it is not really using sys.stdout. In fact the normal print works fine from the command prompt (at least in XP) Alan G. Ricard

Re: [Tutor] Sleeping it out

2007-12-08 Thread Alan Gauld
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote > import time > L = [i for i in xrange(20)] > for n, i in enumerate(L) : >if n%3 == 0 and n > 0 : >print 'waiting 3 seconds' >time.sleep(3) >print i > > I'm using Py 2.51 and PyAlaMode. It works ok but instead of printing > in > gr

Re: [Tutor] thread and os.pipe

2007-12-08 Thread Alan Gauld
"Tiago Saboga" <[EMAIL PROTECTED]> wrote >> Why not just set up outw to the output of Popen? > > Because in the more complicated case, the run function would have > several steps, including some external processes with Popen. The > run() > function will take care of determining which processes wi

Re: [Tutor] logic for a tree like structure

2007-12-08 Thread Jeff Younker
Pipes and IO channels are buffered. The buffers are much larger than the amount of information you are writing to them, so they're never getting flushed while the program is running. The child program completes, the IO channel closes, and it flushes out the output. My advice is to forget abo

Re: [Tutor] thread and os.pipe

2007-12-08 Thread Tiago Saboga
On Sat, Dec 08, 2007 at 11:54:07AM -, Alan Gauld wrote: > "Tiago Saboga" <[EMAIL PROTECTED]> wrote > > > what's happening in this simple example. I want to establish a > > connection between my two threads by a os.pipe, > > While its possible to use a pipe to communicate within a process > it

Re: [Tutor] Sleeping it out

2007-12-08 Thread Eric Brunson
Yes, import sys, then sys.stdout.flush() when you need it. Ricardo Aráoz wrote: > Hi, I have this code : > > import time > L = [i for i in xrange(20)] > for n, i in enumerate(L) : > if n%3 == 0 and n > 0 : > print 'waiting 3 seconds' > time.sleep(3) > print i > > I'm usin

[Tutor] Sleeping it out

2007-12-08 Thread Ricardo Aráoz
Hi, I have this code : import time L = [i for i in xrange(20)] for n, i in enumerate(L) : if n%3 == 0 and n > 0 : print 'waiting 3 seconds' time.sleep(3) print i I'm using Py 2.51 and PyAlaMode. It works ok but instead of printing in groups of three, it will go through the

[Tutor] Timed While Loops Thank You

2007-12-08 Thread earlylight publishing
Thank you all so much for your patience and help! I haven't had a chance to try any of the code yet (gotta go be a mommy first) :^) I look forward to sitting down and playing around with it this evening though! I also finally found a book that seems to fit my learning style well. Hopefully

Re: [Tutor] thread and os.pipe (was: logic for a tree like structure)

2007-12-08 Thread Alan Gauld
"Tiago Saboga" <[EMAIL PROTECTED]> wrote > what's happening in this simple example. I want to establish a > connection between my two threads by a os.pipe, While its possible to use a pipe to communicate within a process its not very helpful and very rarely done. Usially queues are used for commu

Re: [Tutor] Best way of learning

2007-12-08 Thread Dick Moores
At 02:43 PM 12/5/2007, andy wrote: >Over a year ago I dabbled in learning Python, working my way through a >few tutorials, the Deitel's "How to program in Python" and Hetland's >"Practical Python", until I came across the OOP sections. My mind just >froze up, and I found myself wondering if I had

[Tutor] thread and os.pipe (was: logic for a tree like structure)

2007-12-08 Thread Tiago Saboga
I started a message, changed my mind, wrote about some other thing and forgot to change the subject. Sorry for the noise. Tiago. On Sat, Dec 08, 2007 at 07:25:16AM -0200, Tiago Saboga wrote: > Hi, > > I need an additional thread in my app, and I am trying to understand > how it works. Alas, all

[Tutor] logic for a tree like structure

2007-12-08 Thread Tiago Saboga
Hi, I need an additional thread in my app, and I am trying to understand how it works. Alas, all I found about threads is too simple (does not fit in my real life problem) or too complicated. The best thing I've read until now is the great tutorial by Norman Matloff, but it isn't enough. If you co

Re: [Tutor] Still Can't Find Timed While Loops

2007-12-08 Thread Dick Moores
At 09:11 PM 12/6/2007, earlylight publishing wrote: >Hello all, > >I now have my bit of code in while loop form and it works! It's >great but not exactly what I wanted to do. I've been googling my >heart out and I find lots of info on while loops and lots of info on >timers that will execute a