Re: [Tutor] Stupid newbie question

2005-09-24 Thread grouchy
As long as you are using IDLE, why not let it handle indentation for you?  This could very well be a dumb question, and if it is, well, excuse me :)On 9/23/05, Valone, Toren W. <[EMAIL PROTECTED]> wrote: I am trying to noodle thru classes with python and I built the followingclassimport timeclass

Re: [Tutor] Sum of List Elements

2005-09-24 Thread grouchy
Also, the built in function sum(): total = sum(list) Which is probably the One Obvious Way since 2.3, if I had to guess.  On 9/24/05, R. Alan Monroe < [EMAIL PROTECTED]> wrote:> Hi All,> I have spent an embarrassingly large amount of time trying to solve what on > its face seems like a simple prob

Re: [Tutor] Problem with BeautifulSoup

2005-09-23 Thread grouchy
Hi Bernard,   Not much of an answer, but I printed out your snippet with prettify() to see how it was being parsed, and either the XML is funny, or Beautiful Soup is :) >>> from BeautifulSoup import BeautifulStoneSoup as BSS >>> soup = BSS(xml)>>> print soup.prettify()              1  3   1.797693

Re: [Tutor] installation programs

2005-09-21 Thread grouchy
Hi Jeff,Most people seem to use a combination of py2exe, and either Inno Setup or NSIS.  InstallShield is commercial, and, well, you have to pay for it. py2exe gives you the python interpreter, and all the libraries your program needs in a tidy little package, so unless the computers you are instal

Re: [Tutor] Any suggestions for optimizing this code?

2005-09-19 Thread grouchy
Replying to myself, I got some speedups by replacing:def makeArray1(matrix):    result = matrix    result[0][w/2] = 1    for row in range(h-1):    last = result[row]    next = result[row+1]     for i in range(w-1):     next[i] = rule[4*last[i-1]+2*last[i]+last[i+1]]    next[

Re: [Tutor] ElementTree: finding a tag with specific attribute

2005-09-19 Thread grouchy
Now I can replace my my Kent-and-Danny patched version :)On 9/19/05, Bernard Lebel <[EMAIL PROTECTED]> wrote: Thanks a lot everyone for this! Glad I could help debug BS!Bernard On 9/19/05, Kent Johnson <[EMAIL PROTECTED]> wrote:> Kent Johnson wrote:> > I looked at this again and there is a bug in B

Re: [Tutor] Any suggestions for optimizing this code?

2005-09-18 Thread grouchy
ng window type situation. On 9/18/05, John Fouhy <[EMAIL PROTECTED]> wrote: On 19/09/05, grouchy <[EMAIL PROTECTED]> wrote:> I've been playing with generating 1-D cellular automata, and this is the> fastest solution I've come up with so far. I haven't dug deep into y

[Tutor] Any suggestions for optimizing this code?

2005-09-18 Thread grouchy
Hello again!I've been playing with generating 1-D cellular automata, and this is the fastest solution I've come up with so far. In the makeArray() function below, I have a sliding window of three elements starting at row[-1,0,1] and going to row[-2,-1,0], so that it wraps around at either boundary.

[Tutor] Beautiful Soup / Unicode problem?

2005-08-26 Thread grouchy
>This is the first question in the BeautifulSoup FAQ at >http://www.crummy.com/software/BeautifulSoup/FAQ.html >Unfortunately the author of BS considers this a problem with your Python installation! So it >seems he doesn't have a good understanding of Python and Unicode. (OK, I can forgive him >th

Re: [Tutor] Beautiful Soup / Unicode problem?

2005-08-26 Thread grouchy
Hi Danny, > If you have a moment, do you mind doing this on your system? > Here you go: >>> import types >>> print types.StringTypes (, ) >>> import sys >>> print sys.version 2.3.4 (#2, May 29 2004, 03:31:27) [GCC 3.3.3 (Debian 20040417)] >>> print type(u'hello' in types.StringTypes True >>>sys

[Tutor] Beautiful Soup / Unicode problem?

2005-08-25 Thread grouchy
Hi, I'm having bang-my-head-against-a-wall moments trying to figure all of this out. A word of warming, this is the first time I've tried using unicode, or Beautiful Soup, so if I'm being stupid, please forgive me. I'm trying to scrape results from google as a test case. with Beautiful Soup. I'