[Tutor] Using Python in Windows

2008-06-25 Thread Ben
Hi, I'm trying to learn Python in Windows XP. I've been going through the Python version of Allen Downey's open source textbook. I frequently find that the instructions he gives don't work for me when I try to run them in IDLE. For example, in Ch. 4 he says you should load up GASP

Re: [Tutor] Astonishing timing result

2008-06-25 Thread Kent Johnson
On Wed, Jun 25, 2008 at 1:16 AM, Dick Moores [EMAIL PROTECTED] wrote: 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:

Re: [Tutor] Using Python in Windows

2008-06-25 Thread broek
- Message from [EMAIL PROTECTED] - Date: Tue, 24 Jun 2008 18:27:59 -0700 From: Ben [EMAIL PROTECTED] Hi, I'm trying to learn Python in Windows XP. I've been going through the Python version of Allen Downey's open source textbook. I frequently find that the instructions he

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

2008-06-25 Thread Jacqui
Hi, I'm a total newbie too, and I'm kind of replying to see if my instinct on the whole GOTO thing is correct. It's hard to learn a language without any feedback! I used GW and Color Basic when I was a kid so I know all about GOTO (and it was a mess! I programmed one of those interactive stories

Re: [Tutor] python web documentation ( without frameworks?)

2008-06-25 Thread Kent Johnson
On Tue, Jun 24, 2008 at 11:00 PM, Patrick [EMAIL PROTECTED] wrote: 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

[Tutor] Transporting Voices For Sapi

2008-06-25 Thread FT
Hi! I am sending the latest version of my voice package and 2 different tests. When compiling the Voice2.py you may get an error if you do not have MSVcp.dll copied into your setup.py file. In other words a copy command to copy the dll from your system32 folder. For if you do not, some

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

2008-06-25 Thread Cédric Lucantis
Le Wednesday 25 June 2008 12:16:24 Jacqui, vous avez écrit : Hi, I'm a total newbie too, and I'm kind of replying to see if my instinct on the whole GOTO thing is correct. It's hard to learn a language without any feedback! I used GW and Color Basic when I was a kid so I know all about GOTO

Re: [Tutor] Transporting Voices For Sapi and DLL Correction

2008-06-25 Thread FT
Hi! I am sending the latest version of my voice package and 2 different tests. When compiling the Voice2.py you may get an error if you do not have MSVcp71.dll copied into your setup.py file. In other words a copy command to copy the dll from your system32 folder. For if you do not, some

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

2008-06-25 Thread bob gailer
Jacqui wrote: Hi, I'm a total newbie too, and I'm kind of replying to see if my instinct on the whole GOTO thing is correct. It's hard to learn a language without any feedback! I used GW and Color Basic when I was a kid so I know all about GOTO (and it was a mess! I programmed one of those

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

2008-06-25 Thread bob gailer
bob gailer wrote: Jacqui wrote: Hi, I'm a total newbie too, and I'm kind of replying to see if my instinct on the whole GOTO thing is correct. It's hard to learn a language without any feedback! I used GW and Color Basic when I was a kid so I know all about GOTO (and it was a mess! I

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

2008-06-25 Thread Jacqui
LOL You rock! That's definitely better than my example. I can't wait to get better at this! :-D On Wed, 2008-06-25 at 09:22 -0400, bob gailer wrote: Even better is to define a Chapter class, with the various properties and methods pertinent thereto, then make each chapter an instance

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

2008-06-25 Thread bhaaluu
Brian Wisti has a very nice tutorial for Python beginners that uses Interactive Fiction as the basis of a tutorial: http://coolnamehere.com/geekery/python/ifiction/index.html http://coolnamehere.com/geekery/python/ifiction/single-round.html

Re: [Tutor] Another Newbie question

2008-06-25 Thread Lie Ryan
That's because you're doing it in interactive mode. In interactive mode, the code is treated like commands, it is executed immediately after the command is finished. You may differentiate Interactive Mode and Normal/Coding Mode by the prompt, in Coding Mode there is no prompt cause, in Interactive

Re: [Tutor] Astonishing timing result

2008-06-25 Thread Lie Ryan
I'm a bit curious about how you do the timing. I think there is a flaw in how you measured the time. I made this code and the result is inconclusive. ## CODE: test.py #!/usr/bin/env python import imported import time from imported import * def b(): a = 1 r = range(500) t_a, t_b, t_c,

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

2008-06-25 Thread Lie Ryan
If it was me, I'd elaborate it a bit more by separating between program (logic) and story (data). This would make it possible to tell story without touching the program's code. like this (in pseudocode): # main.py def querier(query): while True: print query.prompt t =

Re: [Tutor] Astonishing timing result

2008-06-25 Thread Kent Johnson
On Wed, Jun 25, 2008 at 12:05 PM, Lie Ryan [EMAIL PROTECTED] wrote: t_a = min(t_A, t_a) t_b = min(t_A, t_b) t_c = min(t_A, t_c) t_d = min(t_A, t_d) What is this for? It should at least be t_B, t_C, t_D. ## OUTPUT # 1.02956604958 # 1.02956604958 # 1.02956604958 #

Re: [Tutor] Astonishing timing result

2008-06-25 Thread Lie Ryan
On Wed, 2008-06-25 at 12:56 -0400, Kent Johnson wrote: On Wed, Jun 25, 2008 at 12:05 PM, Lie Ryan [EMAIL PROTECTED] wrote: t_a = min(t_A, t_a) t_b = min(t_A, t_b) t_c = min(t_A, t_c) t_d = min(t_A, t_d) What is this for? It should at least be t_B, t_C, t_D. A common

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

2008-06-25 Thread kinuthiA muchanE
On Wed, 2008-06-25 at 01:49 +0200, [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

Re: [Tutor] Astonishing timing result

2008-06-25 Thread Kent Johnson
On Wed, Jun 25, 2008 at 2:06 PM, Lie Ryan [EMAIL PROTECTED] wrote: On Wed, 2008-06-25 at 12:56 -0400, Kent Johnson wrote: On Wed, Jun 25, 2008 at 12:05 PM, Lie Ryan [EMAIL PROTECTED] wrote: t_a = min(t_A, t_a) t_b = min(t_A, t_b) t_c = min(t_A, t_c) t_d = min(t_A, t_d)

Re: [Tutor] python web documentation ( without frameworks?)

2008-06-25 Thread Alan Gauld
Patrick [EMAIL PROTECTED] wrote 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 general python web programming? Most of the general web programming books seem to be from 2004 or before. There's a

[Tutor] Removing files based upon time stamps

2008-06-25 Thread chase pettet
I'm trying to create a basic script that will remove old backup files (more than 30 days) from a directory based upon timestamp. The system it will run on is Windows XP. I created this and ran it on one box and it seemed to work fine, when I ported it to the actual box it needs to run on it is

Re: [Tutor] Astonishing timing result

2008-06-25 Thread Lie Ryan
On Wed, 2008-06-25 at 15:53 -0400, Kent Johnson wrote: On Wed, Jun 25, 2008 at 2:06 PM, Lie Ryan [EMAIL PROTECTED] wrote: On Wed, 2008-06-25 at 12:56 -0400, Kent Johnson wrote: On Wed, Jun 25, 2008 at 12:05 PM, Lie Ryan [EMAIL PROTECTED] wrote: t_a = min(t_A, t_a) t_b = min(t_A,

[Tutor] Removing files based upon time stamps

2008-06-25 Thread Lie Ryan
I'm not sure what caused your problem, but... os.chdir(c:\BACKUPS\DEV1) This is a no-no. What if you have a path like this: 'C:\nice\try' what do you think would python be doing? It would parse \n as newline and \t as tab You should do this instead: r'C:\nice\try' OR 'C:\\nice\\try' the

Re: [Tutor] Removing files based upon time stamps

2008-06-25 Thread Steve Willoughby
You might also want to consider using the path walk facility in Python's standard lib as well, so you can recurse into subdirectories doing this (if that is helpful) -- Steve Willoughby| Using billion-dollar satellites [EMAIL PROTECTED] | to hunt for Tupperware.

Re: [Tutor] Removing files based upon time stamps

2008-06-25 Thread Steve Willoughby
On Thu, Jun 26, 2008 at 04:53:14AM +0700, Lie Ryan wrote: I'm not sure what caused your problem, but... Look at where you're checking the file time. You're not checking the file itself, but '.' (the time of the current directory). -- Steve Willoughby| Using billion-dollar satellites

[Tutor] Fw: python web documentation ( without frameworks?)

2008-06-25 Thread ALAN GAULD
Forwarding to list. Please use Reply All when reponding to posts. - Forwarded Message From: Jeff Johnson [EMAIL PROTECTED] To: Alan Gauld [EMAIL PROTECTED] Sent: Wednesday, 25 June, 2008 9:51:33 PM Subject: Re: [Tutor] python web documentation ( without frameworks?) This was crazy. The

Re: [Tutor] Removing files based upon time stamps

2008-06-25 Thread broek
- Message from [EMAIL PROTECTED] - Date: Thu, 26 Jun 2008 04:53:14 +0700 From: Lie Ryan [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Subject: [Tutor] Removing files based upon time stamps To: tutor@python.org I'm not sure what caused your problem, but...

Re: [Tutor] python web documentation ( without frameworks?)

2008-06-25 Thread Patrick
Thanks guys for responding to my post. I did buy a book on turbogears today and I am watching some screencasts as well, I don't want to be ignorant of frameworks. I don't think anyone could argue that working without a framework is better for the majority of people, I can clearly see the

Re: [Tutor] python web documentation ( without frameworks?)

2008-06-25 Thread Alan Gauld
Kent Johnson [EMAIL PROTECTED] wrote Anyway, it really is your choice. If your needs are simple, or you want to learn how stuff works, you can use plain CGI or mod_python. If you will need the features of a framework, you might be better off starting with a framework. I'd go so far as to

Re: [Tutor] Removing files based upon time stamps

2008-06-25 Thread Alan Gauld
Lie Ryan [EMAIL PROTECTED] wrote You should do this instead: r'C:\nice\try' OR 'C:\\nice\\try' the first way is called raw string, the backslash lose its meaning the second way is by escaping the backslash. Or just use forward slashes which work on *nix or windows... 'C:/nice/try' HTH,

Re: [Tutor] Removing files based upon time stamps

2008-06-25 Thread Marc Tompkins
On Wed, Jun 25, 2008 at 2:21 PM, chase pettet [EMAIL PROTECTED] wrote: import os, time, sys current = time.time() os.chdir(c:\BACKUPS\DEV1) for f in os.listdir('.'): modtime = os.path.getmtime('.') if modtime current - 30 * 86400: os.remove(f) I'm not in a place where I can

Re: [Tutor] Astonishing timing result

2008-06-25 Thread Marilyn Davis
On Tue, June 24, 2008 10:16 pm, Dick Moores wrote: 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:

[Tutor] Invoking Python

2008-06-25 Thread kinuthiA muchanE
On Tue, 2008-06-24 at 11:11 -0700, Danny Laya 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!), hmmm..., and save the file as anything you want, lets say for now you save the file as