[Tutor] "Lock"ing threads

2005-08-28 Thread Hans Dushanthakumar
Hi, In a multithreaded program, how do I ensure that a block of code in a thread is always executed fully before passing control to another thread. Does "Lock" serve this purpose? The foll program is a dummy one, with 2 threads. One put a number onto a queue (of max size 1) and the other thread

[Tutor] [Fwd: Re: Importing a List from Module]

2005-08-28 Thread Tom Strickland
Original Message Subject:Re: Importing a List from Module Date: Sun, 28 Aug 2005 16:37:26 -0500 From: Tom Strickland <[EMAIL PROTECTED]> To: tutor@python.org The problem has been solved. It turned out that I made a newbie mistake that had nothing to do with i

Re: [Tutor] Importingf a List from Module

2005-08-28 Thread lumbricus
Hello! >>When I do this it prints out the entire "close" list, not just the first >>term. In your module: >for i in range(5): >print close[i] Here you tell it to do so. It does it when it gets imported. HTH and Greets, J"o! -- Wir sind jetzt ein Imperium und wir schaffen uns unsere eigen

Re: [Tutor] Exceptions and its error messages

2005-08-28 Thread lumbricus
Hello! Don't know if someone wrote this already. >But how knowing all error messages from some module? >Is there any way of knowing from python interactive line? >>> for i in dir(__builtins__): >>> if i.endswith("Error"): print i HTH and Greets, J"o! -- Wir sind jetzt ein Imperium und wi

Re: [Tutor] Importingf a List from Module

2005-08-28 Thread Kent Johnson
I'm still stumped by this one. Here is a stripped-down version of your code that works fine for me: # test.py #!/usr/bin/python2.4 import enterData xy=enterData.close print xy[0] print "Finished" ##This is the enterData.py module ##!/usr/bin/python2.4 input = open('SPY2.csv', 'r') close =

Re: [Tutor] Importingf a List from Module

2005-08-28 Thread Orri Ganel
On 8/28/05, Tom Strickland <[EMAIL PROTECTED]> wrote: Tom Strickland wrote:>>Here are the modules in question:>> > ##This is the enterData.py module> ##!/usr/bin/python2.4> input = open('/home/tom/Python/Input/SPY2.csv', 'r')> s = input> date =[]> open = []> close = []> hi = [] > lo = []> v

Re: [Tutor] Importing a List from Module

2005-08-28 Thread Tom Strickland
Tom Strickland wrote: > Eric, > > No, "xy" isn't used anywhere else in the program. It's just a dummy > variable I used to print out "enterData.close". I could easily have > left it out. > > Tom > > > Eric Walker wrote: > >>I am a newbie but do you have anything else named xy >>in your main modu

Re: [Tutor] Importing a List from Module

2005-08-28 Thread Tom Strickland
Byron, I'm confused (as usual). In "def returnList():" that you write below, should the items in the newList list be close[i] and looped to fill "newList" with the contents of "close"? If so, how is "returnLost" different from "close"? Thanks! Tom Byron wrote: > Tom Strickland wrote: > >>

Re: [Tutor] Importingf a List from Module

2005-08-28 Thread Tom Strickland
Tom Strickland wrote: >>Here are the modules in question: >> >> > This is the main.py module > > #!/usr/bin/python2.4 > import enterData > import movAvg > smavg=[] > xy=enterData.close > print xy[0] > smavg = movAvg.sma(20,enterData.close) > emavg=[] > emavg=movAvg.ema(20,enterData.close)

[Tutor] New Tutorial topic

2005-08-28 Thread Alan G
Hi gang, I've just uploaded two new files to my tutorial. The first explains a new section in the tutor aimed at highlighting practical applications of the language, the second is the first of these and introduces databases, SQL and using the Python DBI interface. Enjoy, and as ever feedback i