Re: [Tutor] Astonishing timing result

2008-06-24 Thread Dick Moores
At 07:00 PM 6/24/2008, Marilyn Davis wrote: Has anyone ever timed the difference between using a function that was imported with: from my_module import MyFunction and: import my_module Here are 2 comparisons: , and

[Tutor] python web documentation ( without frameworks?)

2008-06-24 Thread Patrick
Hi Everyone This is my first post here. I would like to switch from php/mysql to python(mod_python) and postgresql. There are several recent books on cherrypy, django and turbogears but for some reason I just don't want to use a framework. Are there any current books you could recommend for g

[Tutor] [Fwd: Re: Astonishing timing result]

2008-06-24 Thread Marilyn Davis
On Tue, June 24, 2008 5:52 pm, Dick Moores wrote: > At 05:35 PM 6/24/2008, Kent Johnson wrote: > >> On Tue, Jun 24, 2008 at 5:20 PM, Dick Moores <[EMAIL PROTECTED]> wrote: >> >> >>> Basically, I'm not worried, just curious. Not about the small >>> differences, but why did the use of the standard

[Tutor] python mechanize - clicking javascript button

2008-06-24 Thread James
Hi, I'm having a bit of a problem and am hoping that someone can assist (I realize this may be slightly off-topic, but I haven't found a good place to post this question, so... ;)) I'm writing a script to interact with a website. There's a form similar to the following in the website: ...stuff.

Re: [Tutor] Python to exe--how much work?

2008-06-24 Thread John Fouhy
On 25/06/2008, Alan Gauld <[EMAIL PROTECTED]> wrote: > "Keith Suda-Cederquist" <[EMAIL PROTECTED]> wrote > > that imports and uses several modules: SciPy, NumPy, > > PIL (python imaging library) and matplotlib. > I'm not aware of anty issues with those modules/libraries > but you never know till

Re: [Tutor] Astonishing timing result

2008-06-24 Thread Dick Moores
At 05:35 PM 6/24/2008, Kent Johnson wrote: On Tue, Jun 24, 2008 at 5:20 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > Basically, I'm not worried, just curious. Not about the small differences, > but why did the use of the standardif __name__ == '__main__' result > it such speed? Because

Re: [Tutor] Astonishing timing result

2008-06-24 Thread Kent Johnson
On Tue, Jun 24, 2008 at 5:20 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > Basically, I'm not worried, just curious. Not about the small differences, > but why did the use of the standardif __name__ == '__main__' result > it such speed? Because __name__ is not equal to "__main__", so you w

Re: [Tutor] Astonishing timing result

2008-06-24 Thread Dick Moores
At 04:49 PM 6/24/2008, Marilyn Davis wrote: Does this mean that if __name__ == "__main__" takes the extra time? and that that's brings t2 in line with the others? I don't think so. Please refer to the code again: . Line 21 is if __name__ == '_

Re: [Tutor] Astonishing timing result

2008-06-24 Thread Marilyn Davis
On Tue, June 24, 2008 2:06 pm, [EMAIL PROTECTED] wrote: > - Message from [EMAIL PROTECTED] - > Date: Tue, 24 Jun 2008 13:44:00 -0700 > From: Dick Moores <[EMAIL PROTECTED]> > > >> At 12:44 PM 6/24/2008, Kent Johnson wrote: >> >>> On Tue, Jun 24, 2008 at 1:43 PM, Dick Moores <[EMAIL PRO

Re: [Tutor] Python to exe--how much work?

2008-06-24 Thread Alan Gauld
"Keith Suda-Cederquist" <[EMAIL PROTECTED]> wrote Question: How hard is it to convert python code to an exe? Not too hard if you know computers. Quite hard for a complete novice. py2exe seems to be the most popular option. Details: I've written some test software in python for my company. W

Re: [Tutor] closing a internet explorer com object

2008-06-24 Thread John Fouhy
On 25/06/2008, Jeff Peery <[EMAIL PROTECTED]> wrote: > hello, > I'm using internet explorer to print out html documents and I'm not sure how > to close it once it is created. How do I do this? below is the simple bit of > code I use to print documents. > > ie = > win32com.client.Dispatch("I

Re: [Tutor] Astonishing timing result

2008-06-24 Thread Dick Moores
At 02:06 PM 6/24/2008, [EMAIL PROTECTED] wrote: - Message from [EMAIL PROTECTED] - Date: Tue, 24 Jun 2008 13:44:00 -0700 From: Dick Moores <[EMAIL PROTECTED]> At 12:44 PM 6/24/2008, Kent Johnson wrote: On Tue, Jun 24, 2008 at 1:43 PM, Dick Moores <[EMAIL PROTECTED]> wrote:

Re: [Tutor] Astonishing timing result

2008-06-24 Thread broek
- Message from [EMAIL PROTECTED] - Date: Tue, 24 Jun 2008 13:44:00 -0700 From: Dick Moores <[EMAIL PROTECTED]> At 12:44 PM 6/24/2008, Kent Johnson wrote: On Tue, Jun 24, 2008 at 1:43 PM, Dick Moores <[EMAIL PROTECTED]> wrote: Output: t1 is 0.000104, no function t2 is 5.87e

Re: [Tutor] Astonishing timing result

2008-06-24 Thread Dick Moores
At 12:44 PM 6/24/2008, Kent Johnson wrote: On Tue, Jun 24, 2008 at 1:43 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > Output: > t1 is 0.000104, no function > t2 is 5.87e-006, function explicit > t3 is 0.000126, function imported > t1/t2 is 17.8 > t1/t3 is 0.827 > t3/t2 is 21.5 > > Now, I'd heard t

Re: [Tutor] Tutor Digest, Vol 52, Issue 66

2008-06-24 Thread Alan Gauld
"kinuthiA muchanE" <[EMAIL PROTECTED]> wrote ... or you could start you fire up a text editor (something like Notepad in Windows, or nano in Linux and type "3+4"(without the quotes!), Actually it would need to be print 3+4 otherwise Python would silently evaluate the expression but not disp

Re: [Tutor] Hands-on beginner's project?

2008-06-24 Thread Alan Gauld
"nathan virgil" <[EMAIL PROTECTED]> wrote I'm very new to Python, and (to a slightly lesser extent) programming in general. I'd like to get some experience by practicing simple-yet-functional programs, That is not a bad idea but... I figure I just need to use a lot of print, if/elif/else,

Re: [Tutor] closing a internet explorer com object

2008-06-24 Thread John Chandler
Below is a bit of code that should work, you might want to change ieregex because right now it will close anything that has "Microsoft Internet Explorer" in the title bar. Have fun. import win32con import win32gui import win32process import re def getHwnds(): def callback(hwnd, hwnds):

Re: [Tutor] Hands-on beginner's project?

2008-06-24 Thread David
On Tue, Jun 24, 2008 at 5:37 PM, nathan virgil <[EMAIL PROTECTED]> wrote: > I'm very new to Python, and (to a slightly lesser extent) programming in > general. I'd like to get some experience by practicing simple-yet-functional > programs, with a bit of an emphasis on games. The first game I'd like

Re: [Tutor] Hands-on beginner's project?

2008-06-24 Thread Cédric Lucantis
> > No, it was whether or not the engine and data could be separated into two > different files, like most modern games. If I ever manage to make really > complex stuff, I might want to take a page out of Id's book and make the > engine open source. > Yes that's what you should do. In python term

Re: [Tutor] Astonishing timing result

2008-06-24 Thread Kent Johnson
On Tue, Jun 24, 2008 at 1:43 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > Output: > t1 is 0.000104, no function > t2 is 5.87e-006, function explicit > t3 is 0.000126, function imported > t1/t2 is 17.8 > t1/t3 is 0.827 > t3/t2 is 21.5 > > Now, I'd heard that code in a function runs faster than the s

[Tutor] Python to exe--how much work?

2008-06-24 Thread Keith Suda-Cederquist
Hi All, Question: How hard is it to convert python code to an exe? Details: I've written some test software in python for my company.  We'd like to be able to distribute the software without having to install python on the instrument computer. The software itself is several hundred lines of co

[Tutor] closing a internet explorer com object

2008-06-24 Thread Jeff Peery
hello, I'm using internet explorer to print out html documents and I'm not sure how to close it once it is created. How do I do this? below is the simple bit of code I use to print documents. thanks! Jeff ie = win32com.client.Dispatch("InternetExplorer.Application")

[Tutor] Astonishing timing result

2008-06-24 Thread Dick Moores
I haven't done much timing using Timer from the timeit module, so maybe I haven't done this correctly, but I'm amazed at the difference in speed between importing a function and not importing it but instead putting it directly into a script. Please look at < http://py77.python.pastebin.com/f152b6

Re: [Tutor] Tutor Digest, Vol 52, Issue 66

2008-06-24 Thread kinuthiA muchanE
On Tue, 2008-06-24 at 15:26 +0200, [EMAIL PROTECTED] wrote: > Message: 5 > Date: Tue, 24 Jun 2008 05:47:29 -0700 (PDT) > From: Danny Laya <[EMAIL PROTECTED]> > Subject: [Tutor] fibonacci.py task ??? > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="iso-8

Re: [Tutor] Hands-on beginner's project?

2008-06-24 Thread Cédric Lucantis
Le Tuesday 24 June 2008 17:37:00 nathan virgil, vous avez écrit : > I'm very new to Python, and (to a slightly lesser extent) programming in > general. I'd like to get some experience by practicing > simple-yet-functional programs, with a bit of an emphasis on games. The > first game I'd like to at

Re: [Tutor] fibonacci.py task ???

2008-06-24 Thread Marc Tompkins
On Tue, Jun 24, 2008 at 6:40 AM, John Patrick Gerdeman < [EMAIL PROTECTED]> wrote: > (You could potentially start the sequence anywhere, e.g at a=5 and b=7, or > over all prime numbers, it > would still be a Fibonacci sequence, though not the one commonly known) > Actually, a series that follows

Re: [Tutor] Hands-on beginner's project?

2008-06-24 Thread bob gailer
nathan virgil wrote: I'm very new to Python, and (to a slightly lesser extent) programming in general. I'd like to get some experience by practicing simple-yet-functional programs, with a bit of an emphasis on games. The first game I'd like to attempt would be a simple, non-linear story, simil

Re: [Tutor] Hands-on beginner's project?

2008-06-24 Thread bhaaluu
Take a look at this page, and see if it is what you're looking for: http://www.geocities.com/ek.bhaaluu/python/index.html I haven't worked on this project in awhile because I got sidetracked by other things, but it's still on the backburner. One day I'll pick it up again. I think Text Adventure G

[Tutor] Hands-on beginner's project?

2008-06-24 Thread nathan virgil
I'm very new to Python, and (to a slightly lesser extent) programming in general. I'd like to get some experience by practicing simple-yet-functional programs, with a bit of an emphasis on games. The first game I'd like to attempt would be a simple, non-linear story, similar to those choose-your-ad

Re: [Tutor] fibonacci.py task ???

2008-06-24 Thread John Patrick Gerdeman
Fibonacci.py calculates the Fibonacci numbers (the sum of the two previous numbers), also see http://en.wikipedia.org/wiki/Fibonacci_number Files that end in .py are python files. Much like .txt are text files and .odc is OpenOffice Calc file. Though you can name any file as you wish, the convent

Re: [Tutor] fibonacci.py task ???

2008-06-24 Thread bhaaluu
On Tue, Jun 24, 2008 at 8:47 AM, Danny Laya <[EMAIL PROTECTED]> wrote: > Hi all, can you explain me what this code mean : > Fibonacci.py > > # This program calculates the Fibonacci sequence > a = 0 > b = 1 > count = 0 > max_count = 20 > while count < max_count: > count = count + 1 > # we ne

Re: [Tutor] fibonacci.py task ???

2008-06-24 Thread Cédric Lucantis
Le Tuesday 24 June 2008 14:47:29 Danny Laya, vous avez écrit : > Hi all, can you explain me what this code mean : > > Fibonacci.py > > # This program calculates the Fibonacci sequence > a = 0 > b = 1 > count = 0 > max_count = 20 > while count < max_count: > count = count + 1 > # we need to

[Tutor] fibonacci.py task ???

2008-06-24 Thread Danny Laya
Hi all, can you explain me what this code mean : Fibonacci.py # This program calculates the Fibonacci sequence a = 0 b = 1 count = 0 max_count = 20 while count < max_count: count = count + 1 # we need to keep track of a since we change it old_a = a old_b = b a = old_b b

Re: [Tutor] Another Newbie question

2008-06-24 Thread bhaaluu
On Tue, Jun 24, 2008 at 6:23 AM, Danny Laya <[EMAIL PROTECTED]> wrote: > Hi I got some problem about writting convention in python. Some tutorial ask > me to write this : > > a = 1 > s = 0 > print 'Enter Numbers to add to the sum.' > print 'Enter 0 to quit.' > while a != 0: > print 'Current Sum

Re: [Tutor] Another Newbie question

2008-06-24 Thread Cédric Lucantis
Le Tuesday 24 June 2008 12:23:41 Danny Laya, vous avez écrit : > Hi I got some problem about writting convention in python. Some tutorial > ask me to write this : > > a = 1 > s = 0 > print 'Enter Numbers to add to the sum.' > print 'Enter 0 to quit.' > while a != 0: > print 'Current Sum:', s >

[Tutor] Another Newbie question

2008-06-24 Thread Danny Laya
Hi I got some problem about writting convention in python. Some tutorial ask me to write this : a = 1 s = 0 print 'Enter Numbers to add to the sum.' print 'Enter 0 to quit.' while a != 0: print 'Current Sum:', s a = int(raw_input('Number? ')) s = s + a print 'Total Sum =', s And the

Re: [Tutor] I need to learn more about sorting!

2008-06-24 Thread Kent Johnson
On Tue, Jun 24, 2008 at 1:15 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > At 07:15 PM 6/23/2008, Kent Johnson wrote: >> You should learn how to use list comprehensions: >> alist_tup_elements_reversed.append = [ (x[1], x[0]) for x in alist ] > > Now, that's why I don't use them. They don't make sen