Re: [Tutor] Removing a row from a tab delimitted text

2004-12-06 Thread Danny Yoo
On Mon, 6 Dec 2004, kumar s wrote: Here is how my file looks: Name=3492_at Cell1=481 13 (The space between (481 and 13 is tab) Cell1=481 13 Cell1=481 13 Name=1001_at Cell1=481 13 Cell2=481 12 Cell1=481 13 Cell1=481 13 Cell2=481 12 Name=1002_at Cell3=482 12 Cell1=481 13 Cell1=481

Re: [Tutor] Problem with python2.4.

2004-12-09 Thread Danny Yoo
On Thu, 9 Dec 2004, Jacob S. wrote: Nothing I can do can fix my problem. It appears as though pythonw.exe is not working properly in the python 2.4 distribution. [some text cut] The symptoms: I click on edit with idle--which runs the command C:\python24\pythonw.exe

Re: [Tutor] cgi with system calls

2004-12-14 Thread Danny Yoo
On Tue, 14 Dec 2004, Nik wrote: ok, problem solved (well, partly - at least as much as I need it to be). status = os.system('ps') doesn't set status equal to the output text, it sets it to the return of the call (in this case '0'). What I really want to do is status =

RE: [Tutor] Regexp Not Matching on Numbers?

2004-12-14 Thread Danny Yoo
On Tue, 14 Dec 2004, Gooch, John wrote: I am used to ( in Perl ) the entire string being searched for a match when using RegExp's. I assumed this was the way Python would do it do, as Java/Javascript/VbScript all behaved in this manner. However, I found that I had to add .* in front of my

Re: [Tutor] least squares

2004-12-16 Thread Danny Yoo
On Thu, 16 Dec 2004, mdcooper wrote: I am trying to run a least squares program (written by Konrad Hinsen) Hi Matthew, You're assuming that we know who Konrad Hinsen is. *grin* Ok, when you're referring to the least-squared code, are you referring to a module in Scientific Python? Please

Re: [Tutor] dbcp module

2004-12-17 Thread Danny Yoo
On Fri, 17 Dec 2004, Rene Bourgoin wrote: Yes i believe im looking for the python version of the Jakarta databse connection pool!! Hi Rene, I haven't looked at this too closely yet, but there are projects out there for connection pools. For example: http://sqlrelay.sourceforge.net/

Re: [Tutor] dbcp module

2004-12-17 Thread Danny Yoo
On Fri, 17 Dec 2004, Rene Bourgoin wrote: Ive been learning to interact with databases using python and i was looking for ways to return a SELECT query result in a plain format. what i mean by plain format is : name numberaddress Fred Smith 2125553243 1 main st All

Re: [Tutor] dbcp module

2004-12-17 Thread Danny Yoo
On Fri, 17 Dec 2004, Kent Johnson wrote: The recipe you cite has the pp() function and an example of its use. It sounds like that is what you want. Part of the pandemonium was my fault. I completely missed your earlier post here:

Re: [Tutor] maximum value in a Numeric array

2004-12-10 Thread Danny Yoo
On Fri, 10 Dec 2004, Ertl, John wrote: I am trying to get the maximum value in a 2-D array. I can use max but it returns the 1-D array that the max value is in and I then I need to do max again on that array to get the single max value. There has to be a more straightforward way...I have

Re: [Tutor] Comments appreciated

2004-12-27 Thread Danny Yoo
On Sun, 26 Dec 2004, Jacob S. wrote: The only thing that's missing is that this script can't handle paths like ~/dir/junkthis I believe you're looking for os.path.expanduser(~/dir/junkthis) BTW, trashcan IS a module level variable because it's defined at the module level. Why it says

Re: [Tutor] Comments appreciated

2004-12-27 Thread Danny Yoo
[Jacob] BTW, trashcan IS a module level variable because it's defined at the module level. Why it says it's local is beyond me. [Danny] Ah, you must be running into the global/local gotcha. [long rambling text cut] Wait, wait. Forget everything I said. *grin* I should have read the

Re: [Tutor] Parsing a block of XML text

2004-12-31 Thread Danny Yoo
On Fri, 31 Dec 2004, kumar s wrote: I am trying to parse BLAST output (Basic Local Alignment Search Tool, size around more than 250 KB ). [xml text cut] Hi Kumar, Just as a side note: have you looked at Biopython yet? http://biopython.org/ I mention this because Biopython comes with

Re: [Tutor] Parsing a block of XML text

2005-01-01 Thread Danny Yoo
On Fri, 31 Dec 2004, kumar s wrote: http://www.python.org/doc/lib/dom-example.html Frankly it looked more complex. could I request you to explain your pseudocode. It is confusing when you say call a function within another function. Hi Kumar, A question, though: can you try to explain

Re: [Tutor] O.T.

2005-01-01 Thread Danny Yoo
On Thu, 30 Dec 2004, Anna Ravenscroft wrote: Anna Martelli Ravenscroft 42, 2 children (13 and 11) live with their dad Married this July to the martelli-bot (we read The Zen of Python at our wedding!). We currently live in Bologna, Italy. Hi Anna, Congratulations! Say hi to Alex for me;

[Tutor] The Game of Life

2005-01-03 Thread Danny Yoo
On Mon, 3 Jan 2005, Brian van den Broek wrote: (Aside: one nonobvious example where copying can be avoided is in Conway's Game of Life: when we calculate what cells live and die in the next generation, we can actually use the 'Command' design pattern to avoid making a temporary copy of

Re: [Tutor] regex problem

2005-01-04 Thread Danny Yoo
On Tue, 4 Jan 2005, Michael Powe wrote: def parseFile(inFile) : import re bSpace = re.compile(^ ) multiSpace = re.compile(r\s\s+) nbsp = re.compile(rnbsp;) HTMLRegEx = re.compile(r(lt;|)/?((!--.*--)|(STYLE.*STYLE)|(P|BR|b|STRONG))/?(gt;|) ,re.I) f =

Re: [Tutor] The Game of Life

2005-01-05 Thread Danny Yoo
Just as a warning, none of what I'm going to code here is original at all: I'm rehashing a main idea off of a paper called Using the Game of Life to Introduce Freshman Students to the Power and Elegance of Design Patterns: http://portal.acm.org/citation.cfm?id=1035292.1028706

Re: [Tutor] The Game of Life question

2005-01-05 Thread Danny Yoo
On Wed, 5 Jan 2005, Kooser, Ara S wrote: They picked a project to model the flow of smallpox in a city and surroundings areas. So I saw the game of life and thought maybe they could modify it for use as a smallpox model. Hi Ara, Oh! My apologies for not posting the file as a complete

Re: [Tutor] automatically finding site-packages and python2.3 in a linux machine

2005-01-06 Thread Danny Yoo
On Thu, 6 Jan 2005, Fred Lionetti wrote: I'm working on creating an installer for my program using install shield, and I'd like to know how one can automatically determine if Python 2.3 is installed on a linux machine, and where site-packages is located (so that I can install my own files

Re: [Tutor] replacement for constants from other languages in Python?

2005-01-06 Thread Danny Yoo
On Thu, 6 Jan 2005, Alan Gauld wrote: I'm _very_ used to using C style constants (preprocessor #define directives) or C++ const keyword style, for a variety of reasons. I've yet to see anything covering 'how to work around the lack of constants in Python'...can anyone point me in the

Re: [Tutor] automatically finding site-packages and python2.3 in a linux machine

2005-01-06 Thread Danny Yoo
I'm working on creating an installer for my program using install shield, and I'd like to know how one can automatically determine if Python 2.3 is installed on a linux machine Hi Fred, Sorry about ignoring parts of your question! Unix has default places for putting binaries like

Re: [Tutor] trouble getting a list to update

2005-01-06 Thread Danny Yoo
On Thu, 6 Jan 2005, Vincent Wan wrote: On Jan 6, 2005, at 12:59 PM, Danny Yoo wrote: Can you show us a snippet of the file output? I'm not immediately seeing anything particular with your debugging output statements: Like the computer, I don't yet understand what the problem is. *grin

Re: [Tutor] Problem with a variable in a CGI program

2005-01-07 Thread Danny Yoo
On Fri, 7 Jan 2005, Mark Kels wrote: I started to read the following code (I will start working on it when this problem is fixed) and it looks OK while I read it. But for some reason it doesn't work... Hi Mark, Ok, let's take a look at the error message: Traceback (most recent call

Re: [Tutor] Input to python executable code and design question

2005-01-10 Thread Danny Yoo
To help you out. You need some sort of error checking to be sure that within your given range you won't get something like a math domain error. Yes, I thought that: try: #function exception: pass Hi Ismael, Python's keyword for exception handling is 'except', so this can

Re: [Tutor] Slightly OT - Python/Java

2005-01-10 Thread Danny Yoo
On Tue, 11 Jan 2005, Liam Clarke wrote: (Why can't a non-static method comparison be called from a static reference? What does that mean anyway? Er... What was your code like? (before and after correcting the error) Hi Liam, It's actually easier to see the reason if we do

Re: [Tutor] Is there a way to force update the screen in tkinter?

2005-01-10 Thread Danny Yoo
On Mon, 10 Jan 2005, R. Alan Monroe wrote: I don't have the code here at home, but today I tried my first experiments in Tkinter. I set up a button that fired off a function to resize a rectangle in a canvas, with a for loop. Only problem is that the screen isn't repainted in all the steps

Re: [Tutor] Time script help sought!

2005-01-11 Thread Danny Yoo
On Tue, 11 Jan 2005, kevin parks wrote: but as always you may notice a wrinkle some items have many times (here 6) indicated: Item_3TAPE_139:4110:41 Item_3TAPE_1410:4711:19 Item_3TAPE_1511:2111:55 Item_3TAPE_1611:5812:10

Re: [Tutor] FW: hi

2005-01-11 Thread Danny Yoo
On Wed, 12 Jan 2005, Gopinath V, ASDC Chennai wrote: I'm a Novice in python.can u tell me if there is a frontend available .if yes where can i download it from Hello Gopinath, Can you explain what you mean by frontend? The word frontend suffers from being too generic to be able to tell

RE: [Tutor] FW: hi (fwd)

2005-01-12 Thread Danny Yoo
Can you explain what you mean by frontend? The word frontend suffers from being too generic to be able to tell what you mean. I meant a GUI like Microsofts Visual Basic [Keeping Tutor@python.org in CC. Please use Reply-to-all in replies, so that we can keep the conversation on list.]

Re: [Tutor] class instance with identity crisis

2005-01-12 Thread Danny Yoo
On Wed, 12 Jan 2005, Barnaby Scott wrote: I was wondering how you can get an instance of a class to change itself into something else (given certain circumstances), but doing so from within a method. So: class Damson: def __str__(self): return 'damson' def dry(self):

Re: [Tutor] what's a concise way to print the first elements in a nested list

2005-01-12 Thread Danny Yoo
On Wed, 12 Jan 2005, Orri Ganel wrote: stuff = [[0,'sdfsd','wrtew'], [1, 'rht','erterg']] stuff [[0, 'sdfsd', 'wrtew'], [1, 'rht', 'erterg']] print [stuff[i][0] for i in range(len(stuff))] [0, 1] Hi Orri, An alternative way to write this is: ### print [row[0] for row in stuff]

Re: [Tutor] sockets, files, threads

2005-01-12 Thread Danny Yoo
On Wed, 12 Jan 2005, Marilyn Davis wrote: When stuff was read from the exim socket, it was stored in a tempfile, so that I could release the exim process, then I lseek to the front of the tempfile and have it handy. I see from all my debugging and logging that the file descriptor for this

Re: [Tutor] sockets, files, threads

2005-01-12 Thread Danny Yoo
Just double checking something: are you dealing with threads? Hi Marilyn, Argh, that was a dumb question. Pretend I didn't ask it that way. *grin* I meant to ask: How do you deal with threads? Is the temporary file a global resource that the threads all touch? If so, have you done any

Re: [Tutor] sockets, files, threads

2005-01-12 Thread Danny Yoo
On Wed, 12 Jan 2005, Marilyn Davis wrote: I was looking at my use of file objects and file descriptors and I wrote this sample program and was very surprised by the result -- which makes me think there's something here that I don't understand. Where did my 'ooo' go? #! /usr/bin/env python

Re: [Tutor] Regular expression re.search() object . Please help

2005-01-13 Thread Danny Yoo
On Thu, 13 Jan 2005, kumar s wrote: My list looks like this: List name = probe_pairs Name=AFFX-BioB-5_at Cell1=96 369 N control AFFX-BioB-5_at Cell2=96 370 N control AFFX-BioB-5_at Cell3=441 3 N control AFFX-BioB-5_at Cell4=441 4 N

Re: [Tutor] communication between java and python?

2005-01-13 Thread Danny Yoo
On Thu, 13 Jan 2005, joeri honnef wrote: I'm trying to communicate between Python and Java and using os.popen(). But thing dont work...The Java program reads strings from stdin and the python program just writes to stdout. Hi Joeri, You may want to look at:

Re: [Tutor] sockets, files, threads

2005-01-15 Thread Danny Yoo
I have only wrapped my lock around file-descriptor creations. Should I wrap it around closings too? Or the whole open - close transaction? It sounds like error-prone work to do the latter. What am I missing? Hi Marilyn, Can you send a link to the source code to the Tutor list? I'm

Re: [Tutor] RE:

2005-01-17 Thread Danny Yoo
stuff = [[0,'sdfsd','wrtew'], [1, 'rht','erterg']] stuff [[0, 'sdfsd', 'wrtew'], [1, 'rht', 'erterg']] print [stuff[i][0] for i in range(len(stuff))] [0, 1] An alternative way to write this is: ### print [row[0] for row in stuff] ### which extracts the first

Re: [Tutor] sockets, files, threads

2005-01-18 Thread Danny Yoo
Hi Marilyn, [Long program comments ahead. Please forgive me if some of the comments are overbearing; I'm trying to get over a cold, and I'm very grumpy. *grin*] Some comments on the code follow. I'll be focusing on: http://www.maildance.com/python/doorman/py_daemon.py One of the import

Re: [Tutor] sockets, files, threads

2005-01-18 Thread Danny Yoo
On Tue, 18 Jan 2005, Danny Yoo wrote: In fact, as far as I can tell, none of the Spawn() threads are communicating with each other. As long as your threads are working independently of each other --- and as long as they are not writing to global variables --- you do not need locks

Re: [Tutor] sockets, files, threads

2005-01-18 Thread Danny Yoo
On Tue, 18 Jan 2005, Marilyn Davis wrote: while 1: if log.level log.calls: log.it(fd%d:py_daemon.py: Waiting ..., self.descriptor) try: client_socket, client_addr = self.server_socket.accept() except (EOFError,

Re: [Tutor] A somewhat easier way to parse XML

2005-01-19 Thread Danny Yoo
On Wed, 19 Jan 2005, Max Noel wrote: I've just spent the last few hours learning how to use the DOM XML API (to be more precise, the one that's in PyXML), instead of revising for my exams :p. My conclusion so far: it sucks (and so does SAX because I can't see a way to use it for OOP

Re: [Tutor] Popen and sending output to a file

2005-01-19 Thread Danny Yoo
On Wed, 19 Jan 2005, Ertl, John wrote: I am using the subprocess.Popen from 2.4. I can launch a job from python and the output from the job goes to the screen but now I would like to have the output go to a file. I could do the crude subprocess.Popen(dtg | cat job.out, shell=True) But

Re: [Tutor] sockets, files, threads

2005-01-19 Thread Danny Yoo
On Wed, 19 Jan 2005, Marilyn Davis wrote: class Exim: def __init__(self): self.fdin = None self.err_flush = [] self.stdout, self.stdin, self.stderr = popen2.popen3('%s -t' % MAILER) self.fdin = self.stdin.fileno() self.fdout =

Re: [Tutor] Combination

2005-01-21 Thread Danny Yoo
On Fri, 21 Jan 2005, Guillermo Fernandez Castellanos wrote: I'm trying to take a list and find all the unique combinations of that list. I mean: if I enter (1,2,3,4,5) and I watn combinations of 3, I want to find: (1,2,3) but then not (2,1,3), (3,1,2),... (1,2,4) (1,2,5) (2,3,5)

Re: [Tutor] Combination

2005-01-21 Thread Danny Yoo
On Fri, 21 Jan 2005, Danny Yoo wrote: I mean: if I enter (1,2,3,4,5) and I watn combinations of 3, I want to find: (1,2,3) but then not (2,1,3), (3,1,2),... (1,2,4) (1,2,5) (2,3,5) (3,4,5) There is a clean recursive way to define this. Hi Guillermo, Gaaa; I screwed up

Re: [Tutor] Python Scripting

2005-01-22 Thread Danny Yoo
On Sat, 22 Jan 2005, Ali Polatel wrote: I want to ask you something that I am really curious about. Can I design web-pages with python or use py files to write html? Hi Ali, Almost every programming language allows us to write strings into files, so from an academic standpoint,

Re: [Tutor] Changing (Unix) environment for python shell/popen() commands

2005-01-23 Thread Danny Yoo
On Sun, 23 Jan 2005, Scott W wrote: I've got to shell out from my python code to execute a command, but _must_ set the environment at the same time (or prior to execution). I saw some comments about setting os.environ[some shell var], but didn't seem to be seeing this work in subsequent

Re: [Tutor] sorting a 2 gb file

2005-01-25 Thread Danny Yoo
On Tue, 25 Jan 2005, Scott Melnyk wrote: I have an file in the form shown at the end (please forgive any wrapparounds due to the width of the screen here- the lines starting with ENS end with the e-12 or what have you on same line.) What I would like is to generate an output file of any

Re: [Tutor] Read file line by line

2005-01-25 Thread Danny Yoo
On Tue, 25 Jan 2005, Gilbert Tsang wrote: Hey you Python coders out there: Being a Python newbie, I have this question while trying to write a script to process lines from a text file line-by-line: #!/usr/bin/python fd = open( test.txt ) content = fd.readline() while (content != ):

Re: [Tutor] Read file line by line

2005-01-25 Thread Danny Yoo
There's nothing that really technically prevents us from doing an assignment as an expression, but Python's language designer decided that it encouraged a style of programming that made code harder to maintain. By making it a statement, it removes the possiblity of making a mistake like:

Re: [Tutor] sorting a 2 gb file

2005-01-25 Thread Danny Yoo
On Tue, 25 Jan 2005, Max Noel wrote: My data set the below is taken from is over 2.4 gb so speed and memory considerations come into play. Are sets more effective than lists for this? Sets or dictionaries make the act of lookup of a key fairly cheap. In the two-pass approach, the

Re: [Tutor] Safely buffering user input

2005-01-27 Thread Danny Yoo
On Thu, 27 Jan 2005, Miles Stevenson wrote: I'm trying to practice safe coding techniques. I just want to make sure that a user can't supply a massive argument to my script and cause trouble. I'm just trying only accept about 256 bytes: buffer(sys.argv[1], 0, 256) ^^ Hi Miles,

Re: [Tutor] question regarding python exception handling

2005-01-30 Thread Danny Yoo
On Sat, 29 Jan 2005, Roy wrote: I am learning about python exception handling. I am reading Python in a Nutshell. In the chapter of exception handling, it says: Note that the try/finally form is distinct from the try/except form: a try statement cannot have both except and finally clauses,

Re: [Tutor] Using exec with dict

2005-01-30 Thread Danny Yoo
On Mon, 31 Jan 2005, [ISO-8859-1] Andr Roberge wrote: / I have a robot that can do some actions like move() and // turn_left(). I can program this robot using python like this: // // .def move_and_turn(): [snip]// // The question I have is: how do I do this with an explicit

Re: [Tutor] files in a directory

2005-01-31 Thread Danny Yoo
Now that I am reading many files at once, I wanted, to have a tab delim file op that looks like this: My_coors Int_file 1 Int_file2 IntFile3 01:26 34 235 245.45 04:42 342.4452.445.5 02:56 45.4 34.5

Re: [Tutor] Newbie struggling with Tkinter/canvas tags

2005-01-31 Thread Danny Yoo
On Sun, 30 Jan 2005, Glen wrote: As a Python/Tkinter newbie, I thought I was getting on ok... then I hit this problem. I have a canvas (c1) A group of objects are drawn on c1 and given a tag c1.addtag_all('group_A') Another group of objects are drawn, I wish to tag these

Re: [Tutor] Newbie struggling with Tkinter/canvas tags

2005-01-31 Thread Danny Yoo
On Mon, 31 Jan 2005, Danny Yoo wrote: I think that getting this right will take some more work. Here's a definition of a function called find_withouttag(): [Code cut] Oh! Never mind; this can be a lot simpler. According to the Gotchas section of: http://tkinter.unpythonic.net/wiki

Re: [Tutor] Newbie struggling with Tkinter/canvas tags

2005-01-31 Thread Danny Yoo
Now I've just got to work out how to tag a list of id's... There doesn't seem to be a way to tag a known id, it has to be tagged by reference from an id above or below which seems odd! Hi Glen, Have you tried the addtag_withtag() method? It looks like it should be able to do what you're

Re: [Tutor] Comparing files, Counting Value

2005-01-31 Thread Danny Yoo
Hi Michiyo, Ok, let's take a look at the code. i=open(file 1) #value data o=open(file 2) #look-up file l=open(result, 'w')#result We strongly recommend renaming these names to ones that aren't single characters. It's difficult to tell here what 'i', 'o', and 'l' mean, outside of the

Re: [Tutor] Better structure?

2005-01-31 Thread Danny Yoo
On Mon, 31 Jan 2005, Jacob S. wrote: I think this thing is screaming for better structure, but previous attempts at using oop for it have failed. Hi Jacob, Ok, I see one big refactoring that should help things quite a bit. There's a large case-analysis off if/elif/elif statements that

Re: [Tutor] Better structure?

2005-02-02 Thread Danny Yoo
On Tue, 1 Feb 2005, Jacob S. wrote: Also why shouldn't string methods include stuff like lstrip which do precisely what I request? Hi Jacob, I think the confusion here is that, in Python, strings can be considered a concrete single thing, but they can also be considered an ordered

Re: [Tutor] Presentation

2005-02-02 Thread Danny Yoo
The community is one of the things I particularly like about Python. I always hated asking a question in the Perl newsgroups; although you usually got an answer, you were almost certain to be told you're stupid for not already knowing it. Hi Terry, Just to act as Devil's advocate: the

Re: [Tutor] Python 2.4 with Mandrake 10.0 query

2005-02-02 Thread Danny Yoo
On Wed, 2 Feb 2005, Glen wrote: [EMAIL PROTECTED] glen]$ idle set([34, 36, 38, 39]) Failed to load extension 'CodeContext' Traceback (most recent call last): File /usr/local/lib/python2.4/idlelib/EditorWindow.py, line 737, in load_standard_extensions self.load_extension(name)

Re: [Tutor] Are you allowed to shoot camels? [kinda OT]

2005-02-02 Thread Danny Yoo
On Thu, 3 Feb 2005, Liam Clarke wrote: Had the *ahem* joy of learning Perl last night. Egad. Wrote the script in Python to get it right, and then 'translated' it to Perl. Hi Liam, I strongly recommend sending the Perl code to that Perl-beginners mailing list referenced earlier. I'm sure

Re: [Tutor] In-place changes on loops

2005-02-03 Thread Danny Yoo
But let's change it to what I think you were thinking of: ### def lstrip(string, chars): scratchspace = list(string) ## get a mutable list of characters for x in scratchspace: if x in chars: scratchspace[i] = '' return ''.join(scratchspace) ###

[Tutor] switch vs table dispatch

2005-02-04 Thread Danny Yoo
On Fri, 4 Feb 2005, Smith, Jeff wrote: What you are try to do is execute a block of code based on the value of a single statement. if/elif doesn't do that and thereby introduces the possibility of errors. switch on-this: case 'a': do something case 'b':

Re: [Tutor] arrays

2005-02-04 Thread Danny Yoo
On Fri, 4 Feb 2005, alieks lao wrote: in this tutorial it's telling me to from Numeric import * to load array functions but it doesn't work is there a replacement for Numeric or are arrays built in functions? Hi Alieks, Just out of curiosity, which tutorial are you reading? The

Re: [Tutor] arrays

2005-02-04 Thread Danny Yoo
On Fri, 4 Feb 2005, alieks lao wrote: Just out of curiosity, which tutorial are you reading? heres the url... http://www.pentangle.net/python/ Hi Alieks, Ah, ok, that makes sense now. Michael William's tutorial assumes an environment where some third-party modules, like Numeric, have

Re: [Tutor] question about expressing mathematical equations

2005-02-04 Thread Danny Yoo
On Fri, 4 Feb 2005, alieks lao wrote: Once again i have a question concerning something from the tutorial im being tortured by. ___ x.y= \ x (dot)y(dot) /__ i i How would i express this in python. If the above doesn't make any sense to ya'll. It's at the bottom

Re: [Tutor] Iterating over multiple lists- options

2005-02-07 Thread Danny Yoo
On Mon, 7 Feb 2005, Tony Cappellini wrote: There are 4 lists total, each of which *may* have a different length from the other lists. Each list has been stored in a master dictionary. North=[Bill, Bob, Sue, Mary] South=['Tim', ''Tom', 'Jim', 'John', 'Carl', 'Evan', 'Rich'] etc I want to

Re: [Tutor] where do we use acquisition ?

2005-02-07 Thread Danny Yoo
Hi Chandu, Ah, so you're looking into environmental acquisition. I think the reason you're asking about on Tutor is because one of the most visible deployments of acquisition has been in the Zope web framework. But just because Zope is written in Python doesn't mean that acquisition is a

Re: [Tutor] python lists to C arrays and vice versa

2005-02-07 Thread Danny Yoo
On Mon, 7 Feb 2005, Viktor Hornak wrote: I've been trying to find more resources/documentation about how to convert python lists to C arrays (and vice versa) when writing a python extension. Hi Viktor, There was a post back in 1999 that might be useful for you:

Re: [Tutor] CRC-16 calculation

2005-02-08 Thread Danny Yoo
On Tue, 8 Feb 2005, Johan Geldenhuys wrote: I have a data packet in Hex values and need to determine how to calculate the CRC-16 bit checksum for these values: 0x55,0x00,0x0A,0x01,0x01, 0x01,0xFF,0x00,0xDC,0xCC Sync|Lenght |source addr|dest. adr |Data| CRC check| This example shows me

Re: [Tutor] What is in the traceback object

2005-02-08 Thread Danny Yoo
On Tue, 8 Feb 2005, Ertl, John wrote: I have a bit of code that uses a module and I am trying to get more info on the error. I am using this bit of code: try: rhfill= Ngl.contour(wks,rhisobar,rh_res) except: execType,value,tracebak = sys.exc_info()[:3]

Re: [Tutor] help

2005-02-08 Thread Danny Yoo
On Tue, 8 Feb 2005, james middendorff wrote: I want to use mysqldb to add people into a database, but when I ask for the certain fields like Name, PhoneNumber and such, I cannot get it to put them in as a string? I am not sure what I am doing wrong but here is my code thanks to anyone who

Re: e-mail address change (was Re: [Tutor] python's default argument value handling in functions - weird syntax? problem grappling with the concept)

2005-02-09 Thread Danny Yoo
On Thu, 10 Feb 2005, Jeffrey Lim wrote: Example 1 def f(a,L=[]): ... if L==[5]: ... print 'L==[5] caught' ... print L ... print 'resetting L...' ... L=[] ... L.append(a) ... return L ... Hi Jeffery, At the beginning of a function

Re: [Tutor] help with refactoring needed -- which approach is more Pythonic?

2005-02-09 Thread Danny Yoo
On Wed, 9 Feb 2005, Brian van den Broek wrote: Hi all, I have data files with a format that can be scheamatized as: File Header Contents . . . File Header End Tag Node Header Contents . . . Node Header End Tag Node Contents . . . Node End Tag [Repeat Node elements until end of

Re: e-mail address change (was Re: [Tutor] python's default argument value handling in functions - weird syntax? problem grappling with the concept)

2005-02-09 Thread Danny Yoo
On Thu, 10 Feb 2005, Ismael Garrido wrote: Danny Yoo wrote: ### def f(a,L=[]): if L==[5]: print 'L==[5] caught' print L print 'resetting L...' L=[] L.append(a) return L ### Now I'm dizzy... I can't understand why there are two L! Hi

Re: [Tutor] Simple question on creating a filter

2005-02-11 Thread Danny Yoo
On Fri, 11 Feb 2005, Smith, Jeff wrote: I'm sorry to both with such a simple question but I've looked in the normal places and don't see the quick and dirty answer I know must exist. I want to write a simple line selection filter that could be used like: filter file I get the

Re: [Tutor] Idle needles

2005-02-11 Thread Danny Yoo
On Fri, 11 Feb 2005, Lobster wrote: The tutorials I am accessing with Firefox and there seems to be a conflict in which the Idle editor is trying to (or reported as accessing the Net but does not (according to the literature and warning) Hello! IDLE does use network connections to talk to

Re: ****SPAM(11.2)**** [Tutor] Larger program organization

2005-02-11 Thread Danny Yoo
way we ASP.NET at my company, and I'm having some trouble finding a good way to organize all the code. My take on doing that in Python: Organize things into modules. Especially with an eye to potential reuse. Look at the module index in the docs to see how most of the standard modules

Re: [Tutor] References in loops

2005-02-12 Thread Danny Yoo
On Fri, 11 Feb 2005, Matt Dimmic wrote: In Python, one bug that often bites me is this: (example A) aList = [1,2,3] for i in aList: i += 1 print aList -- [1,2,3] This goes against my intuition, which is that aList == [2,3,4], probably because so much in Python is passed by

Re: [Tutor] Idle needles

2005-02-12 Thread Danny Yoo
On Sat, 12 Feb 2005, Lobster wrote: Idols subprocess didn't make connection Either Idle can't start or personal firewall is blocking the connection = Now I am getting the added message that the socket connection is refused (recently updated to the latest Zone Alarm) Hi Ed, That's

Re: [Tutor] I thank you . . .

2005-02-14 Thread Danny Yoo
On Mon, 14 Feb 2005, Lobster wrote: # Wikipedia single word search engine # Monday Feb 14 import webbrowser sought_word = raw_input(What is your wikipedia search word? ) goto_url_location = http://en.wikipedia.org/wiki/; + sought_word webbrowser.open(goto_url_location) Hi Lobster,

Re: [Tutor] calling an external program

2005-02-14 Thread Danny Yoo
On Mon, 14 Feb 2005, Alan Gauld wrote: - I am trying to call up an external program with something like a Shell command - can not find a way of doing this (in windows) Look in the os module, there are several options depending on exactly what you need to do. The simplest option is

Re: [Tutor] newbie OSX module path question

2005-02-14 Thread Danny Yoo
On Mon, 14 Feb 2005, Mike Hall wrote: I'm on OS X, and I cannot get Python to import modules I've saved. I have created the the environment.plist file and appended it with my desired module path. If I print sys.path from the interpreter, my new path does indeed show up as the first listing,

Re: [Tutor] SQL Datetimes

2005-02-14 Thread Danny Yoo
On Mon, 14 Feb 2005, Bill Kranec wrote: I'm using Kinterbasdb to access a Firebird database through Python, and when I retrieve a row with a datetime value, I get a tuple like: myCursor.execute( 'SELECT * FROM table' ) for row in myCursor.fetchall(): print row (DateTime

Re: [Tutor] count words

2005-02-15 Thread Danny Yoo
On Tue, 15 Feb 2005, Ron Nixon wrote: I know that you can do this to get a count of home many times a word appears in a file f = open('text.txt').read() print f.count('word') Other than using a several print statments to look for seperate words like this, is there a way to do it so

Re: [Tutor] Basic terminology

2005-02-15 Thread Danny Yoo
A remainder is what's left over after a division: 10/3 = 3 remainder 1 12/5 = 2 remainder 2 27/3 = 9 remainder 0 and the modulus operator (which is % in python) gives you that remainder: 10%3 = 1 12%5 = 2 27%3 = 0 Hi Bernard, Another familiar example of modulo is checking to see if

RE: [Tutor] Case acceptance using raw_input

2005-02-15 Thread Danny Yoo
On Wed, 16 Feb 2005, Tony Meyer wrote: Is there a better way for raw_input to accept both caps and lower case letters than: [...] if action == 'y' or action == 'Y': if action in 'yY': dostuff() [...] Although, that does mean that if a user enters 'nN' they'll get no, but

Re: [Tutor] Help needed with script to batch-create shapefiles

2005-02-16 Thread Danny Yoo
On Wed, 16 Feb 2005, Bill Mill wrote: I have several thousand files in dBaseIV format that I need to convert to shapefiles for use in ArcGIS. I've written a script (see below) to automate this process but thus far have been unable to get it to work. I suspect that there's a simple

Re: [Tutor] how to read from a txt file

2005-02-17 Thread Danny Yoo
Traceback (most recent call last): File C:\Python23\practices\opentxt, line 12, in -toplevel- process(data) File C:\Python23\practices\opentxt, line 6, in process data_points.append(int(line)) ValueError: invalid literal for int(): Hi Brian, Ah, think about empty

Re: [Tutor] Advanced Calculator Program...

2005-02-19 Thread Danny Yoo
I want to make caculator program which enables me to enter 2numbers and mathsmatics sign and calculates it. I think this is too difficult for newbie like me... Please input data Number1: Mathsmetics Sign: Number2: (Number1) (Sign) (Number2) = (Result) *One* way to solve

Re: [Tutor] database programming

2005-02-21 Thread Danny Yoo
On Mon, 21 Feb 2005, Chris Mallari wrote: hi there! can u pls send me sample code in accessing a simple database using python. Hi Chris, You may want to look at the Database topic guide: http://www.python.org/topics/database/ It has links to examples, tutorials, and other

Re: [Tutor] subclassing list -- slicing doesn't preserve type

2005-02-22 Thread Danny Yoo
I'm trying to figure out how to subclass the list built-in. You could do it e.g. like that: class Mylist (list): def __init__(self, seq=None): super(self.__class__, self).__init__(seq) def __getslice__(self, start, stop): return

Re: [Tutor] Python sizeof()

2005-02-23 Thread Danny Yoo
On Wed, 23 Feb 2005, Shitiz Bansal wrote: Is there a python equivalent of c's sizeof function. Unfortuntately, no, not as a standard builtin. However, there is a third-party library called mxTools that does include a sizeof() function: http://www.egenix.com/files/python/mxTools.html

Re: [Tutor] threads

2005-02-23 Thread Danny Yoo
On Wed, 23 Feb 2005, Shitiz Bansal wrote: I am trying to build a traffic network simulator using python, for my degree project. I need to run at least 5-6000 cars simultaneously. I wanted to run each car in a separate thread. However , after about 400 threads i am unable to create new

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Danny Yoo
I'm writing a simple game (run in command line) in which narrative text is printed in response to a user's decisions. The problem I'm running into is that triple quotes used in an indented block preserves the indentation when it prints. [text cut] Why not just take them out

Re: [Tutor] Recursive Tkinter buttons

2005-02-24 Thread Danny Yoo
On Thu, 24 Feb 2005, Adam Cripps wrote: I'm trying to create recursive Tkinter buttons with: for i in range(0,10): print i buttonlabel = field +str(i) button[i] = Button (text=buttonlabel)

  1   2   3   4   5   6   7   8   9   10   >