Re: [Tutor] Should I be thinking of threads for this ?

2005-08-27 Thread Andreas Kostyrka
Am Donnerstag, den 25.08.2005, 20:28 +0100 schrieb Nick Lunt: > Hello folks, > > I have the following code taken from the Twisted examples - > > [code] > # filewatcher.py > from twisted.application import internet > > def watch(fp): > fp.seek(fp.tell()) > for line in fp.readlines

[Tutor] Generate 8 digit random number

2005-08-27 Thread Alberto Troiano
Hey Tutors I saw a lot of responses...After analyze them I have resumed two approaches 1.- Generate a random number from 0 to and fill this number with zeros (Almost everyone's approach) 2.- Generate 8 random numbers and join them (Pietro and someone else) Which one of this is more ran

Re: [Tutor] Should I be thinking of threads for this ?

2005-08-27 Thread Kent Johnson
Nick Lunt wrote: > Hello folks, > > I have the following code taken from the Twisted examples - > > [code] > # filewatcher.py > from twisted.application import internet > > def watch(fp): > fp.seek(fp.tell()) > for line in fp.readlines(): > sys.stdout.write(line)

Re: [Tutor] Strange XP stdin behaviour.

2005-08-27 Thread Tim Peters
[Alan Gauld] > Thanks Danny, interesting link in that it shows a solution I > didn't know about in the one-liner at the bottom of the discussion. > > But really I was hoping someone could explain *why* there is a > difference. If PATHEXT can detect that intest.py needs to be run > through Python w

Re: [Tutor] Should I be thinking of threads for this ?

2005-08-27 Thread Nick Lunt
Hi Kent, > > > > [code] > > # filewatcher.py > > from twisted.application import internet > > > > def watch(fp): > > fp.seek(fp.tell()) > > for line in fp.readlines(): > > sys.stdout.write(line) > > > > import sys > > from twisted.internet import reactor > > s = in

Re: [Tutor] Strange XP stdin behaviour.

2005-08-27 Thread Alan Gauld
>> But really I was hoping someone could explain *why* there is a >> difference. If PATHEXT can detect that intest.py needs to be run >> through Python why doesn't redirection work as expected? What >> is happening to stdin/stdout in this case? > > Alas, only Microsoft could explain this, and AFAIK

Re: [Tutor] Strange XP stdin behaviour.

2005-08-27 Thread Alan Gauld
> have. It's not unique to Python, of course. Here's a confused MS > article about it: > > http://support.microsoft.com/default.aspx?scid=kb;en-us;321788 > > _Some_ of the PATHEXT-related redirection bugs did get fixed in XP, > but not all of them. I haven't tried adding the registry entry they

[Tutor] Importing a List from Module

2005-08-27 Thread Tom Strickland
I have a module called "enterData" which generates a list, "close" from a data file. "close" is a list of floats. When I put a print statement in that module it will print out an individual member of the list. For example, print close[0] prints the first member of the list. In my "main"

Re: [Tutor] Importing a List from Module

2005-08-27 Thread Kent Johnson
Tom Strickland wrote: > I have a module called "enterData" which generates a list, "close" from > a data file. "close" is a list of floats. When I put a print statement > in that module it will print out an individual member of the list. For > example, > > print close[0] > > > prints the

Re: [Tutor] Importing a List from Module

2005-08-27 Thread Byron
Tom Strickland wrote: > In my "main" module I import "enterData" and try to read the first > element of "close" as follows: > > import enterData > xy=enterData.close > print xy[0] > > > When I do this it prints out the entire "close" list, not just the first > term. Hi Tom, I