[Tutor] Python performance resources resouce usage hints

2006-04-07 Thread Liam Clarke
Hi, I've developed what would be my largest Python app to date. And, going from the crude Windows Task Manager, it's trying to use as much CPU time as it can get when it's idle. This, no doub,t is due to my design. I have an UDP socket server, a packet cruncher, and a DAO. Each resides in it's

[Tutor] function caller

2006-04-07 Thread josip
Hi,Can someone explain me function and caller relationship when passing arguments?Thanks How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates.___ Tutor maillist - Tutor@python.org

[Tutor] Quick question,

2006-04-07 Thread Carlos Benevides
Hi, Can someone tell me what the r before the expression means, as in re.compile(r'(\.exe|\.zip|\.pif|\.scr|\.ps|\.pdf|\.ppt)$')? I've seen regular expressions both ways, and I've seen them work with or without the r. Just wondering what it does, or if it makes a difference. Thanks.

Re: [Tutor] Python performance resources resouce usage hints

2006-04-07 Thread Kent Johnson
Liam Clarke wrote: Hi, I've developed what would be my largest Python app to date. And, going from the crude Windows Task Manager, it's trying to use as much CPU time as it can get when it's idle. This, no doub,t is due to my design. I have an UDP socket server, a packet cruncher, and

Re: [Tutor] Python performance resources resouce usage hints

2006-04-07 Thread Hugo González Monteverde
Liam Clarke wrote: Each thread's run() method basically looks like this - while True: try: data = self.queue.get(False) self.DAO.send_data(data) except Empty: if self.shutdown: print \DAO

Re: [Tutor] function caller

2006-04-07 Thread Hugo González Monteverde
josip wrote: Can someone explain me function and caller relationship when passing arguments? Hi... what do you mean? Is there something specific you're not getting if you take a look at: http://www.ibiblio.org/obp/thinkCSpy/chap03.htm

Re: [Tutor] Quick question,

2006-04-07 Thread Hugo González Monteverde
Carlos Benevides wrote: Hi, Can someone tell me what the r before the expression means, as in re.compile(r'(\.exe|\.zip|\.pif|\.scr|\.ps|\.pdf|\.ppt)$')? It is not specific to regular expressions, it is called a raw string. http://docs.python.org/tut/node5.html

[Tutor] string formatting question

2006-04-07 Thread Jerome Jabson
Hello, I'm trying to replace some strings in a line of text, using some regex functions. My question is: If there's more then one regex grouping I want to replace in one line of a file, how can I use the String Formatting operator (%s) in two places? Here's the line it matches in the file:

Re: [Tutor] string formatting question

2006-04-07 Thread Kent Johnson
Jerome Jabson wrote: Hello, I'm trying to replace some strings in a line of text, using some regex functions. My question is: If there's more then one regex grouping I want to replace in one line of a file, how can I use the String Formatting operator (%s) in two places? Hi Jerome, I

Re: [Tutor] Python performance resources resouce usage hints

2006-04-07 Thread Kent Johnson
Hugo González Monteverde wrote: You are not using the optional timeout and blocking which 'get' provides (!) Try setting it and see your CPU usage go down. This will implement blocking, and the queue will be used as soon as data is there.Set block to True and a timeout if you

Re: [Tutor] string formatting question

2006-04-07 Thread Alan Gauld
My problem now is how do I construct the replace statement? twork = m_sock.sub('\1 %s \2 %s', % port_num % proto, twork) The format operator takes a tuple: twork = m_sock.sub('\1 %s \2 %s' % (port_num, proto), twork) So I removed the comma after the string, used a single percent operator

Re: [Tutor] function caller

2006-04-07 Thread Alan Gauld
Hi, Hi, Can someone explain me function and caller relationship when passing arguments? There is an explanation of this in vitually any tutorial on Python. Haver you read any of these? Have you any experience in other languages that we can relate an explanation too? For example, you

Re: [Tutor] string formatting question

2006-04-07 Thread Jerome Jabson
Hi Kent, Sorry I didn't make my question clearer. Bascially I want to replace this line: srm:socket portNumber=138 tcpORudp=UDP address=64.41.134.60/ With: srm:socket portNumber=2 tcpORudp=TCP address=64.41.134.60/ So the regex grouping are that I want to keep portNumber= and tcpORudp= and

Re: [Tutor] string formatting question

2006-04-07 Thread Kent Johnson
Jerome Jabson wrote: Hi Kent, Sorry I didn't make my question clearer. Bascially I want to replace this line: srm:socket portNumber=138 tcpORudp=UDP address=64.41.134.60/ With: srm:socket portNumber=2 tcpORudp=TCP address=64.41.134.60/ So the regex grouping are that I want to

Re: [Tutor] Python performance resources resouce usage hints

2006-04-07 Thread Danny Yoo
On Fri, 7 Apr 2006, Kent Johnson wrote: Hugo Gonz�lez Monteverde wrote: You are not using the optional timeout and blocking which 'get' provides (!) Try setting it and see your CPU usage go down. This will implement blocking, and the queue will be used as soon as data is there.

[Tutor] Unittest not running all test cases

2006-04-07 Thread Carroll, Barry
Greetings: I'm not certain this is the right forum for this question. If not, please point me to the correct one. I am using the unittest module to test a package our team is writing. I presently have three modules of test cases and a top level module to run the entire suite. The

Re: [Tutor] Unittest not running all test cases

2006-04-07 Thread Kent Johnson
Carroll, Barry wrote: Greetings: I'm not certain this is the right forum for this question. If not, please point me to the correct one. I am using the unittest module to test a package our team is writing. I presently have three modules of test cases and a top level module to run the

Re: [Tutor] string formatting question

2006-04-07 Thread Karl Pflästerer
On 7 Apr 2006, [EMAIL PROTECTED] wrote: Sorry I didn't make my question clearer. Bascially I want to replace this line: srm:socket portNumber=138 tcpORudp=UDP address=64.41.134.60/ With: srm:socket portNumber=2 tcpORudp=TCP address=64.41.134.60/ So the regex grouping are that I want

Re: [Tutor] Python performance resources resouce usage hints

2006-04-07 Thread Liam Clarke
Thanks very much all. :) I'll have a crack this afternoon and let you know. Kent - the increase in the queue size for the socket server is to allow for any delay in processing packets; it has a default queue size of 5 and then it starts rejecting packets; more of a safety policy when reducing CPU

Re: [Tutor] Unittest not running all test cases

2006-04-07 Thread Carroll, Barry
Kent: I just rechecked my class names, and there are no duplicates. I was careful to preface all of the classes in testsymc39 with 'C39...', and used 'S25...' in testsym25. Likewise, the classes in each module have names that describe the type of data being tested, so names are unique within

[Tutor] Beginner question (variables, namespaces...)

2006-04-07 Thread Jesse
Why is it that when one variable is assigned a value in terms of another variable, assigning a new value to the first doesn't change the value of the second? This is giving me a huge headache, since I have a bunch of variables defined in terms of one another, and I want to be able to dynamically

Re: [Tutor] Beginner question (variables, namespaces...)

2006-04-07 Thread Danny Yoo
On Fri, 7 Apr 2006, Jesse wrote: Why is it that when one variable is assigned a value in terms of another variable, assigning a new value to the first doesn't change the value of the second? Hi Jesse, If you have a variable that depends on the values of other parameters, that's just

Re: [Tutor] Beginner question (variables, namespaces...)

2006-04-07 Thread Bob Gailer
Jesse wrote: Why is it that when one variable is assigned a value in terms of another variable, assigning a new value to the first doesn't change the value of the second? This is giving me a huge headache, since I have a bunch of variables defined in terms of one another, and I want to be

Re: [Tutor] Unittest not running all test cases

2006-04-07 Thread Carroll, Barry
Kent: -Original Message- From: Kent Johnson [mailto:[EMAIL PROTECTED] Sent: Friday, April 07, 2006 3:59 PM To: Carroll, Barry Subject: Re: [Tutor] Unittest not running all test cases Carroll, Barry wrote: Kent: I just rechecked my class names, and there are no duplicates. I

[Tutor] Watch and control access to an executable

2006-04-07 Thread Bill Burns
Hi Tutors! I have a problem that I've solved using Python, and I want to know if I've done a good job :-) Here's the problem: At my work we have a Windows network. On a network drive lives a program that a couple people need to access (there's a shortcut on each user's Desktop to the

Re: [Tutor] Beginner question (variables, namespaces...) (fwd)

2006-04-07 Thread Danny Yoo
-- Forwarded message -- Date: Fri, 7 Apr 2006 21:05:33 -0600 From: Jesse [EMAIL PROTECTED] To: Danny Yoo [EMAIL PROTECTED] Subject: Re: [Tutor] Beginner question (variables, namespaces...) I tried redefining the higher-order variables as functions, but it didn't quite work.