Re: [Tutor] Google App Engine

2008-04-09 Thread H.C. v. Stockhausen
On Tue, Apr 08, 2008 at 10:35:37AM -0700, Dinesh B Vadhia wrote: Hi! Google announced an app server that allows pure Python developed applications/services to use their infrastructure. This maybe of use to many on this list. Further details can be found at: http://appengine.google.com/

Re: [Tutor] Google App Engine

2008-04-09 Thread Kent Johnson
H.C. v. Stockhausen wrote: On Tue, Apr 08, 2008 at 10:35:37AM -0700, Dinesh B Vadhia wrote: Hi! Google announced an app server how safe is it to just run the dev server, as I didn't get one of the prerelease accounts either. If by 'safe' you mean 'secure', I don't really know but I guess

Re: [Tutor] Tutor Digest, Vol 50, Issue 9

2008-04-09 Thread Gloom Demon
Hello :-) Can someone please explain to me ho can I find out how many elements are there in one record of a list? The problem is as follows: I have a txt file from which I read data into Python. The file looks something like this: 01 bla bla bla 23,15 2345,67 02 alb alb 2,4 890,1 03 bal bla

Re: [Tutor] socket / over network

2008-04-09 Thread linuxian iandsd
in case it helps here is a very basic example: import MySQLdb, glob, os, re, shutil from ftplib import FTP a=file_to_fetch ftp=FTP('ftp_server') ftp.login('user_name','password') try: aa=ftp.nlst(a) b='/home/a' bb=os.path.basename(aa[0]) e=os.path.basename(b) c=open(b, 'wb')

Re: [Tutor] Tutor Digest, Vol 50, Issue 9

2008-04-09 Thread rui
Hi Gloom, You should give a look at the method split (of the string objects) and int. The first is used do break a string into smaller pieces and the other to convert a string to an int object, raising an exception when it is not possible. On Wed, Apr 9, 2008 at 9:29 AM, Gloom Demon [EMAIL

Re: [Tutor] Tutor Digest, Vol 50, Issue 9

2008-04-09 Thread Kent Johnson
Gloom Demon wrote: Hello :-) Can someone please explain to me ho can I find out how many elements are there in one record of a list? The len() function gives the length of a list. I have a txt file from which I read data into Python. The file looks something like this: 01 bla bla

Re: [Tutor] Tutor Digest, Vol 50, Issue 9

2008-04-09 Thread linuxian iandsd
On Wed, Apr 9, 2008 at 12:59 PM, rui [EMAIL PROTECTED] wrote: Hi Gloom, You should give a look at the method split (of the string objects) and int. The first is used do break a string into smaller pieces and the other to convert a string to an int object, raising an exception when it is

Re: [Tutor] Tutor Digest, Vol 50, Issue 9

2008-04-09 Thread Kepala Pening
import re items = [] for line in open('data.txt'): items.append(re.sub('\n', '', line).split(' ')) - Original Message - From: Gloom Demon [EMAIL PROTECTED] To: tutor@python.org Date: Wed, 9 Apr 2008 15:29:35 +0300 Subject: Re: [Tutor] Tutor Digest, Vol 50, Issue 9 Hello :-) Can

Re: [Tutor] Tutor Digest, Vol 50, Issue 9

2008-04-09 Thread Kent Johnson
Kepala Pening wrote: import re items = [] for line in open('data.txt'): items.append(re.sub('\n', '', line).split(' ')) Hmm. So much to say about so little code! - the re.sub() is not needed - the split() will remove the trailing newline: In [53]: 'a b\n'.split() Out[53]: ['a', 'b'] -

Re: [Tutor] Google App Engine

2008-04-09 Thread H.C. v. Stockhausen
On Wed, Apr 09, 2008 at 08:04:03AM -0400, Kent Johnson wrote: H.C. v. Stockhausen wrote: On Tue, Apr 08, 2008 at 10:35:37AM -0700, Dinesh B Vadhia wrote: Hi! Google announced an app server how safe is it to just run the dev server, as I didn't get one of the prerelease accounts

[Tutor] Process that starts processes

2008-04-09 Thread John Chandler
I have been searching for a while but I can't seem to find anything that will do this, so... In my python program I am starting a process using subprocess.Popen. This is working fine, but the process I am starting starts several other processes. Is there any way (using subprocess or a different

[Tutor] Doubts about Pylint

2008-04-09 Thread Dick Moores
I'd never used Pylint until yesterday, when I discovered that Ulipad had a Pylint plugin that enabled me to run Pylint on scripts within Ulipad. But I'm wondering about some of the results. I noticed that it was complaining that my variable names violated convention. Here's an image of running

Re: [Tutor] Doubts about Pylint

2008-04-09 Thread Alex Ezell
On Wed, Apr 9, 2008 at 11:43 AM, Dick Moores [EMAIL PROTECTED] wrote: Comments? Since we started using code profilers and checkers like pyLint etc., we've had a motto: This is a guide. It is not the gospel. Take from pylint what you think helps and ignore the rest. It's just a tool and you

Re: [Tutor] Doubts about Pylint

2008-04-09 Thread Jerry Hill
On Wed, Apr 9, 2008 at 12:43 PM, Dick Moores [EMAIL PROTECTED] wrote: I'd never used Pylint until yesterday, when I discovered that Ulipad had a Pylint plugin that enabled me to run Pylint on scripts within Ulipad. But I'm wondering about some of the results. I noticed that it was

Re: [Tutor] Doubts about Pylint

2008-04-09 Thread Dick Moores
At 09:59 AM 4/9/2008, Alex Ezell wrote: On Wed, Apr 9, 2008 at 11:43 AM, Dick Moores [EMAIL PROTECTED] wrote: Comments? Since we started using code profilers and checkers like pyLint etc., we've had a motto: This is a guide. It is not the gospel. Take from pylint what you think helps and

Re: [Tutor] Doubts about Pylint

2008-04-09 Thread Eric Walstad
On Wed, Apr 9, 2008 at 9:43 AM, Dick Moores [EMAIL PROTECTED] wrote: I'd never used Pylint until yesterday ... Since when is 'az' a bad variable name? And 'AZ' is OK? ... Comments? I understand that Pylint settings and output are *very* customizable. I seem to remember talk about a PEP['Style

Re: [Tutor] Doubts about Pylint

2008-04-09 Thread Dick Moores
At 10:14 AM 4/9/2008, Jerry Hill wrote: Other than the fact that it's a long list, did *you* have any comments? You present this list like it's a bad thing, but it seems to me that pylint is doing exactly what it should. Do you think that there's something wrong with pylint? Are you just

Re: [Tutor] Google App Engine

2008-04-09 Thread bob gailer
I watched the Campfire videos. Very interesting. Big drawback: no support for join queries. Reasons given seemed pretty weak. How would one migrate an existing app that has hundreds of (in some cases) involved joins? The only way I can see is to write a bunch of queries and then join them in the

Re: [Tutor] Google App Engine

2008-04-09 Thread Kent Johnson
bob gailer wrote: I watched the Campfire videos. Very interesting. Big drawback: no support for join queries. Reasons given seemed pretty weak. Because the underlying datastore (BigTable) doesn't support them? I'm not sure but I think this is a key to the scalability of the data store.

[Tutor] List comprehensions

2008-04-09 Thread Dinesh B Vadhia
Here is a for loop operating on a list of string items: data = [string 1, string 2, string 3, string 4, string 5, string 6, string 7, string 8, string 9, string 10, string 11] result = for item in data: result = item + \n print result I want to replace the for loop with a List

Re: [Tutor] List comprehensions

2008-04-09 Thread Jerry Hill
On Wed, Apr 9, 2008 at 7:12 AM, Dinesh B Vadhia [EMAIL PROTECTED] wrote: I want to replace the for loop with a List Comrehension (or whatever) to improve performance (as the data list will be 10,000]. At each stage of the for loop I want to print the result ie. List comprehensions are for

Re: [Tutor] List comprehensions

2008-04-09 Thread linuxian iandsd
On Wed, Apr 9, 2008 at 7:44 PM, Jerry Hill [EMAIL PROTECTED] wrote: On Wed, Apr 9, 2008 at 7:12 AM, Dinesh B Vadhia [EMAIL PROTECTED] wrote: I want to replace the for loop with a List Comrehension (or whatever) to improve performance (as the data list will be 10,000]. At each stage of

Re: [Tutor] List comprehensions

2008-04-09 Thread Dinesh B Vadhia
Sorry, let's start again. Here is a for loop operating on a list of string items: data = [string 1, string 2, string 3, string 4, string 5, string 6, string 7, string 8, string 9, string 10, string 11] result = for item in data: result = some operation on item print result I want to

Re: [Tutor] List comprehensions

2008-04-09 Thread linuxian iandsd
i can't think of anything but a loop here UNLESS you take the list from its source one element at a time, process it then print the result. example of this would be : list comes in from standard input. list comes from a database list is read from a file. so again

Re: [Tutor] List comprehensions

2008-04-09 Thread Kent Johnson
Dinesh B Vadhia wrote: Here is a for loop operating on a list of string items: data = [string 1, string 2, string 3, string 4, string 5, string 6, string 7, string 8, string 9, string 10, string 11] result = for item in data: result = item + \n print result I'm not sure what

Re: [Tutor] List comprehensions

2008-04-09 Thread Kent Johnson
Dinesh B Vadhia wrote: Here is a for loop operating on a list of string items: data = [string 1, string 2, string 3, string 4, string 5, string 6, string 7, string 8, string 9, string 10, string 11] result = for item in data: result = some operation on item print result

Re: [Tutor] List comprehensions

2008-04-09 Thread Jerry Hill
On Wed, Apr 9, 2008 at 4:15 PM, Dinesh B Vadhia [EMAIL PROTECTED] wrote: Sorry, let's start again. This version really isn't any more helpful than the first one. I know you corrected the sample code, but you haven't addressed any of the fundamental questions that Kent or I asked. I want to

Re: [Tutor] List comprehensions

2008-04-09 Thread Jerry Hill
On Wed, Apr 9, 2008 at 4:48 PM, Kent Johnson [EMAIL PROTECTED] wrote: You could use [ sys.stdout.write(some operation on item) for item in data ] but I consider this bad style and I seriously doubt you will see any difference in performance. This really isn't a good idea. It will take

Re: [Tutor] Process that starts processes

2008-04-09 Thread Alan Gauld
John Chandler [EMAIL PROTECTED] wrote working fine, but the process I am starting starts several other processes. Is there any way (using subprocess or a different module) to control the processes the original creates (by control I mean feed them input, capture output, and kill them).

Re: [Tutor] Doubts about Pylint

2008-04-09 Thread Alan Gauld
Dick Moores [EMAIL PROTECTED] wrote Since when is 'az' a bad variable name? And 'AZ' is OK? When it is a constant. pyLint sees that you are assigning a numeroc literal and so thinks that this may be a definition of a constant value. If you disd someting like A = 8 az = A It may well be

[Tutor] Copy script

2008-04-09 Thread Que Prime
I have a folder of 150,000 pdf files and I need to copy 20,000 of them to another folder. The ones I need to copy are in a .txt file. Attached is a sample of the input .txt file and a dos directory of the folder containing the files. I'm not sure of the best way to accomplish this. Thank you

Re: [Tutor] Copy script

2008-04-09 Thread Alan Gauld
Que Prime [EMAIL PROTECTED] wrote I have a folder of 150,000 pdf files and I need to copy 20,000 of them to another folder. The ones I need to copy are in a .txt file. Sounds straightforward but... Attached is a sample of the input .txt file and a dos directory of the folder containing

Re: [Tutor] Copy script

2008-04-09 Thread bob gailer
Alan Gauld wrote: "Que Prime" [EMAIL PROTECTED] wrote I have a folder of 150,000 pdf files and I need to copy 20,000 of them to another folder. The ones I need to copy are in a .txt file. Sounds straightforward but... Attached is a sample of the input .txt

Re: [Tutor] Copy script

2008-04-09 Thread Kent Johnson
Que Prime wrote: I have a folder of 150,000 pdf files and I need to copy 20,000 of them to another folder. The ones I need to copy are in a .txt file. Attached is a sample of the input .txt file and a dos directory of the folder containing the files. I'm not sure of the best way to

Re: [Tutor] Copy script

2008-04-09 Thread Anthony Baldwin
Alan Gauld wrote: Que Prime [EMAIL PROTECTED] wrote I have a folder of 150,000 pdf files and I need to copy 20,000 of them to another folder. The ones I need to copy are in a .txt file. Assuming the text file is a list of those to be copied, wouldn't a simple bash script do the

Re: [Tutor] Doubts about Pylint

2008-04-09 Thread Dick Moores
At 03:15 PM 4/9/2008, Alan Gauld wrote: Dick Moores [EMAIL PROTECTED] wrote Since when is 'az' a bad variable name? And 'AZ' is OK? When it is a constant. pyLint sees that you are assigning a numeric literal and so thinks that this may be a definition of a constant value. If you did