Automatic Generation of Python Class Files

2007-10-22 Thread Sunburned Surveyor
I was thinking of a way I could make writing Python Class Files a little less painful. I was considering a Ptyhon script that read a file with a list of property names and method names and then generated a skeleton class file. I was even thinking of automatically generating the shell for doc strin

Re: Iteration for Factorials

2007-10-22 Thread Paul McGuire
On Oct 22, 8:02 am, vimal <[EMAIL PROTECTED]> wrote: > On Oct 22, 5:43 pm, Marco Mariani <[EMAIL PROTECTED]> wrote: > > > Py-Fun wrote: > > > def itforfact(n): > > > while n<100: > > > print n > > > n+1 > > > n = input("Please enter a number below 100") > > > You function should

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Chris Mellon
On 10/22/07, Sunburned Surveyor <[EMAIL PROTECTED]> wrote: > I was thinking of a way I could make writing Python Class Files a > little less painful. I was considering a Ptyhon script that read a > file with a list of property names and method names and then generated > a skeleton class file. > > I

Re: Iteration for Factorials

2007-10-22 Thread Tim Golden
Marco Mariani wrote: > Tim Golden wrote: > >>> From the cookbook, this time. >>> It satisfies the requirements nicely ;) >>> >>> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691 >> [... snip the ultimate general-purpose answer to the OP's question ... >> >> I really hope that's a w

Re: Iteration for Factorials

2007-10-22 Thread [EMAIL PROTECTED]
On Oct 22, 7:50 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Py-Fun <[EMAIL PROTECTED]> wrote: > > I'm stuck trying to write a function that generates a factorial of a > > number using iteration and not recursion. Any simple ideas would be > > appreciated. > > This version avoids doing anything f

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Sunburned Surveyor
On Oct 22, 10:26 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 10/22/07, Sunburned Surveyor <[EMAIL PROTECTED]> wrote: > > > > > > > I was thinking of a way I could make writing Python Class Files a > > little less painful. I was considering a Ptyhon script that read a > > file with a list of

Re: Iteration for Factorials

2007-10-22 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, Py-Fun <[EMAIL PROTECTED]> wrote: > I'm stuck trying to write a function that generates a factorial of a > number using iteration and not recursion. Any simple ideas would be > appreciated. Well, first think about the recursive implementation: def fact(n):

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Bruno Desthuilliers
Sunburned Surveyor a écrit : > I was thinking of a way I could make writing Python Class Files What's a "Python Class File" ? > a > little less painful. If you find writing classes in Python "painful", then either you have no experience with any mainstream language or you are doing something wr

Re: Python-URL! - weekly Python news and links (Oct 22)

2007-10-22 Thread Steven Bethard
Gabriel Genellina wrote: > "I actually do a lot of unit testing. I find it both annoying and highly > necessary and useful." - Steven Bethard > http://groups.google.com/group/comp.lang.python/msg/4df60bdff72540cb That quote is actually due to Dan McLeran. A very good quote though. Steve -- h

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Chris Mellon
On 10/22/07, Sunburned Surveyor <[EMAIL PROTECTED]> wrote: > On Oct 22, 10:26 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > On 10/22/07, Sunburned Surveyor <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > I was thinking of a way I could make writing Python Class Files a > > > little less pa

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Marc 'BlackJack' Rintsch
On Mon, 22 Oct 2007 11:05:52 -0700, Sunburned Surveyor wrote: > On Oct 22, 10:26 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > You wrote: " can't think of a single reason why you would ever want to > do this, > since your "list of method and property names" would be just as > verbose as just t

Re: Iteration for Factorials

2007-10-22 Thread Paul Rudin
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > On Oct 22, 7:50 am, Duncan Booth <[EMAIL PROTECTED]> wrote: >> Py-Fun <[EMAIL PROTECTED]> wrote: >> > I'm stuck trying to write a function that generates a factorial of a >> > number using iteration and not recursion. Any simple ideas would be >>

Re: Iteration for Factorials

2007-10-22 Thread Rafael Sachetto
The right way is: import operator def fact(x): return reduce(operator.mul, xrange(1,x+1)) On 10/22/07, Paul Rudin <[EMAIL PROTECTED]> wrote: > > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > On Oct 22, 7:50 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > >> Py-Fun <[EMAIL PROTECTED]> wro

Re: Dealing with "funny" characters

2007-10-22 Thread Chris Mellon
On 10/20/07, John Nagle <[EMAIL PROTECTED]> wrote: > Gert-Jan wrote: > > sophie_newbie schreef: > >> Hi, I want to store python text strings that characters like "é" "Č" > >> in a mysql varchar text field. Now my problem is that mysql does not > >> seem to accept these characters. I'm wondering if

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Sunburned Surveyor
On Oct 22, 11:23 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 10/22/07, Sunburned Surveyor <[EMAIL PROTECTED]> wrote: > > > > > > > On Oct 22, 10:26 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > On 10/22/07, Sunburned Surveyor <[EMAIL PROTECTED]> wrote: > > > > > I was thinking of a way

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Steven Bethard
Sunburned Surveyor wrote: > Contents of input text file: > > [Name] > Fire Breathing Dragon > > [Properties] > Strength > Scariness > Endurance > > [Methods] > eatMaiden argMaiden > fightKnight argKnight > > Generated Python Class File: > > def class FireBreathingDragon: > >def getStrengt

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Diez B. Roggisch
> You wrote: " can't think of a single reason why you would ever want to > do this, > since your "list of method and property names" would be just as > verbose as just typing the actual python code." > > I don't think I understand how this would be the same amount of > typing. Consider the followi

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Sunburned Surveyor
On Oct 22, 11:43 am, Steven Bethard <[EMAIL PROTECTED]> wrote: > Sunburned Surveyor wrote: > > Contents of input text file: > > > [Name] > > Fire Breathing Dragon > > > [Properties] > > Strength > > Scariness > > Endurance > > > [Methods] > > eatMaiden argMaiden > > fightKnight argKnight > > > Gene

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Steven Bethard
Sunburned Surveyor wrote: > I also intended to add statements creating properties from the getter > and setter methods. I understand that getters and setters aren't > really necessary if you aren't making a property. I just forgot to add > the property statements to my example. You still don't wan

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Bruno Desthuilliers
Sunburned Surveyor a écrit : > On Oct 22, 10:26 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > (snip) >>I can't think of a single reason why you would ever want to do this, >>since your "list of method and property names" would be just as >>verbose as just typing the actual python code. >> >>Auto

Re: Iteration for Factorials

2007-10-22 Thread Steven Bethard
Michael J. Fromberger wrote: > # Not legal Python code. > def fact3(n, acc = 1): > TOP: > if n > 0 > n = n - 1 > acc = acc * n > goto TOP > else: > return acc Yes, to write this in legal Python code, you have to write:: from goto import goto

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Sunburned Surveyor
On Oct 22, 11:47 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Sunburned Surveyor a écrit : > > > On Oct 22, 10:26 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > (snip) > >>I can't think of a single reason why you would ever want to do this, > >>since your "list of method and property nam

Re: Iteration for Factorials

2007-10-22 Thread [EMAIL PROTECTED]
On Oct 22, 1:35 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > On Oct 22, 7:50 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > >> Py-Fun <[EMAIL PROTECTED]> wrote: > >> > I'm stuck trying to write a function that generates a factorial of a > >> > numbe

ignoring chinese characters parsing xml file

2007-10-22 Thread Fabian López
Hi, I am parsing an XML file that includes chineses characters, like ^ �u�u啖啖才是�w.���扉L锍才是�� or ヘアアイロン... The problem is that I get an error like: UnicodeEncodeerror:'charmap' codec can't encode characters in position The thing is that I would like to ignore it and parse all the characters less

Committing latest patch on Issue 708374 to SVN (adding offset to mmap)

2007-10-22 Thread Travis Oliphant
Hi all, I think the latest patch for fixing Issue 708374 (adding offset to mmap) should be committed to SVN. I will do it, if nobody opposes the plan. I think it is a very important addition and greatly increases the capability of the mmap module. Thanks, -Travis Oliphant -- http://mail.p

Adding idle timeout capabilities to asyncore

2007-10-22 Thread Giampaolo Rodola'
Hi there. We're talking about an asyncore-based server. Just for the heck of it I'd like to set a timeout which will disconnects the clients if they're inactive (i.e., no command or data transfer in progress) for a long period of time. I was thinking about putting the timeout value into an attribut

Re: Iteration for Factorials

2007-10-22 Thread Rafael Sachetto
This works: def fact(x): if x == 0 or x == 1: return 1 else: return reduce(operator.mul, xrange(1,x+1)) or def factorial(n): acc = 1 while n > 1: acc = acc * n n = n - 1 return acc On 10/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > O

Re: using "request" variable in python web program

2007-10-22 Thread sami
> Not exactly - this is the "query string" part of the URI. > Request and Response are the two messages defined by the HTTP protocol. > When you type a URL or click on a link or press a button in a page, your > browser builds the appropiate Request message and sends it to the server. > After proces

Re: C++ version of the C Python API?

2007-10-22 Thread Martin v. Löwis
> This preference, in > turn, is what motivated my original question. The CPython API > interface itself seems modularized, NOT object oriented (only from > what I saw). I suggest you look again, then. Things like PyObject_String, PyObject_GetAttrString, or PySequence_GetItem all express the obje

Re: Iteration for Factorials

2007-10-22 Thread tokland
On 22 oct, 20:35, Paul Rudin <[EMAIL PROTECTED]> wrote: > import operator > def fact(x): > return reduce(operator.mul, xrange(1,x)) Maybe: import operator def fact(x): return reduce(operator.mul, xrange(2, x+1), 1) fact(0) 1 fact(4) 24 -- http://mail.python.org/mailman/listinfo/python

Re: TeX pestilence (was Distributed RVS, Darcs, tech love)

2007-10-22 Thread David Formosa (aka ? the Platypus)
["Followup-To:" header set to comp.lang.functional.] On Mon, 22 Oct 2007 11:30:51 -0400, George Neuner wrote: > On Mon, 22 Oct 2007 05:50:30 -0700, Xah Lee <[EMAIL PROTECTED]> wrote: [...] >>5. This is arguable and trivial, but i think TeX judged as a computer >>language in particular its synta

Re: Iteration for Factorials

2007-10-22 Thread Tim Chase
> def fact(x): > if x == 0 or x == 1: > return 1 > else: > return reduce(operator.mul, xrange(1,x+1)) If obscurity is the name of the game, >>> from operator import mul >>> fact = lambda i: i > 1 and reduce(mul, xrange(1,i+1)) or i >= 0 and 1 or None >>> for i i

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Bruno Desthuilliers
Sunburned Surveyor a écrit : > On Oct 22, 11:47 am, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: (snip) > > Bruno wrote: "You don't need these getters and setters. Python has > support for > computed attributes (look for 'property'), so until you need to > control > access, a plain attribute

Re: ignoring chinese characters parsing xml file

2007-10-22 Thread Marc 'BlackJack' Rintsch
On Mon, 22 Oct 2007 21:24:40 +0200, Fabian López wrote: > I am parsing an XML file that includes chineses characters, like ^ > uu啖啖才是w.扉L锍才是 or ヘアアイロン... The problem is that I get an error like: > UnicodeEncodeerror:'charmap' codec can't encode characters in > position.. You say you are *parsing*

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Bruno Desthuilliers
Steven Bethard a écrit : (snip) > In Python, you can use property() to make method calls look like > attribute access. This could be necessary if you have an existing API > that used public attributes, but changes to your code require those > attributes to do additional calculations now. > > B

Re: Building sparc64 32/64-bit Python

2007-10-22 Thread Martin v. Löwis
> Is this possible or do I really have to install two complete but > separate Pythons although most of the files are the same? That configuration is not explicitly supported in the build process. Notice that the "Python libraries" are not entirely platform independent. On Sparc64, the byte code f

Re: TeX pestilence (was Distributed RVS, Darcs, tech love)

2007-10-22 Thread Joachim Durchholz
George Neuner schrieb: >> 5. This is arguable and trivial, but i think TeX judged as a computer >> language in particular its syntax, on esthetical grounds, sucks in >> major ways. > > No one except you thinks TeX is a "computer language". But it is. It's Turing-complete. And yes, it sucks in maj

Re: Iteration for Factorials

2007-10-22 Thread Paul Rudin
[EMAIL PROTECTED] writes: > On 22 oct, 20:35, Paul Rudin <[EMAIL PROTECTED]> wrote: > >> import operator >> def fact(x): >> return reduce(operator.mul, xrange(1,x)) > > Maybe: > > import operator > def fact(x): > return reduce(operator.mul, xrange(2, x+1), 1) Or just: reduce(operator.mul

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Sunburned Surveyor
On Oct 22, 1:23 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Steven Bethard a écrit : > (snip) > > > In Python, you can use property() to make method calls look like > > attribute access. This could be necessary if you have an existing API > > that used public attributes, but changes to yo

Re: ignoring chinese characters parsing xml file

2007-10-22 Thread Fabian López
Thanks Mark, the code is like this. The attrib name is the problem: from lxml import etree context = etree.iterparse("file.xml") for action, elem in context: if elem.tag == "weblog": print action, elem.tag , elem.attrib["name"],elem.attrib["url"], elem.attrib["rssUrl"] And the xml fi

Re: Need help parsing with pyparsing...

2007-10-22 Thread Just Another Victim of the Ambient Morality
"Paul McGuire" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Oct 22, 4:18 am, "Just Another Victim of the Ambient Morality" > <[EMAIL PROTECTED]> wrote: >> I'm trying to parse with pyparsing but the grammar I'm using is >> somewhat >> unorthodox. I need to be able to pars

Re: Iteration for Factorials

2007-10-22 Thread [EMAIL PROTECTED]
On Oct 22, 3:38 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > On 22 oct, 20:35, Paul Rudin <[EMAIL PROTECTED]> wrote: > > >> import operator > >> def fact(x): > >> return reduce(operator.mul, xrange(1,x)) > > > Maybe: > > > import operator > > def fact(x): > > re

Re: Iteration for Factorials

2007-10-22 Thread [EMAIL PROTECTED]
On Oct 22, 3:22 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > def fact(x): > > if x == 0 or x == 1: > > return 1 > > else: > > return reduce(operator.mul, xrange(1,x+1)) > > If obscurity is the name of the game, > >>>> from operator import mul >>>> fact = lambda i: i

RE: ignoring chinese characters parsing xml file

2007-10-22 Thread Ryan Ginstrom
> On Behalf Of Fabian Lopez > like ^�u�u啖啖才是�w.���扉L锍才是�� or ヘアアイロン... The problem is that I get Just thought I'd point out here that the second string is Japanese, not Chinese. >From your second post, it appears that you've parsed the text without problems -- it's when you go to print them out

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Sunburned Surveyor
On Oct 22, 11:44 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > You wrote: " can't think of a single reason why you would ever want to > > do this, > > since your "list of method and property names" would be just as > > verbose as just typing the actual python code." > > > I don't think I un

Re: if instance exists problem ..

2007-10-22 Thread Mike Orr
On Oct 17, 8:00 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 17 Oct 2007 23:12:15 +, Paul Hankin wrote: > > 'if x' doesn't test if x exists, it tests if x when cast to a bool is > > True. > > To be pedantic: > > Python doesn't have type casts. bool(x) doesn't cast

for loop

2007-10-22 Thread Shawn Minisall
#Intro print "*" print "WELCOME TO THE POPULATION GROWTH CALCULATOR" print "*" print "This program will predict the size of a population of organisms." print print organisms=inp

Re: Check File Change Every 10 Seconds

2007-10-22 Thread Tommy Nordgren
On 22 okt 2007, at 16.45, Robert Rawlins - Think Blue wrote: > Thanks for your time Gabriel, > > That certainly looks to be the type of thing that I'm looking to > achieve, however, I forgot to mention I'm running this on a Linux > platform and not a Win32 one :-( Sorry. > > I'm sure similar

Re: for loop

2007-10-22 Thread Marc 'BlackJack' Rintsch
On Mon, 22 Oct 2007 18:17:56 -0400, Shawn Minisall wrote: > #Intro > print "*" > print "WELCOME TO THE POPULATION GROWTH CALCULATOR" > print "*" > > print "This program will predict the size o

Re: Iteration for Factorials

2007-10-22 Thread [EMAIL PROTECTED]
On Oct 22, 4:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Oct 22, 3:38 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: > > > > > > > [EMAIL PROTECTED] writes: > > > On 22 oct, 20:35, Paul Rudin <[EMAIL PROTECTED]> wrote: > > > >> import operator > > >> def fact(x): > > >> return reduce(

Regular Expression

2007-10-22 Thread patrick . waldo
Hi, I'm trying to learn regular expressions, but I am having trouble with this. I want to search a document that has mixed data; however, the last line of every entry has something like C5H4N4O3 or CH5N3.ClH. All of the letters are upper case and there will always be numbers and possibly one . H

Re: for loop

2007-10-22 Thread [EMAIL PROTECTED]
On Oct 22, 5:22 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 22 Oct 2007 18:17:56 -0400, Shawn Minisall wrote: > > #Intro > > print "*" > > print "WELCOME TO THE POPULATION GROWTH CALCULATOR" > > print "**

Re: Iteration for Factorials

2007-10-22 Thread Tim Chase
>> If obscurity is the name of the game, >> >>>>> from operator import mul >>>>> fact = lambda i: i > 1 and reduce(mul, xrange(1,i+1)) or i >> >= 0 and 1 or None >>>>> for i in xrange(-2,10): print '%i! = %s' % (i, fact(i)) >> >> My eyes hurt after reading that...as the order of operat

Re: for loop

2007-10-22 Thread Steven D'Aprano
On Mon, 22 Oct 2007 18:17:56 -0400, Shawn Minisall wrote: > I'm having problems with my for loop here to calculate estimated > population output to a table. The code you have posted has inconsistent indentation. It won't run as you supply it. > Instead of knowing how much I want to > loop it,

Re: Committing latest patch on Issue 708374 to SVN (adding offset to mmap)

2007-10-22 Thread Travis Oliphant
Travis Oliphant wrote: > Hi all, > > I think the latest patch for fixing Issue 708374 (adding offset to mmap) > should be committed to SVN. > > I will do it, if nobody opposes the plan. I think it is a very > important addition and greatly increases the capability of the mmap module. > > Than

Re: Normalize a polish L

2007-10-22 Thread Mike Orr
On Oct 16, 9:51 am, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: > For example, in Spanish, "ü" (u with umlaut) should be represented as > "u", but in German, it should be represented as "ue". > > pingüino -> pinguino > Frühstück -> Fruehstueck > > I'd like that web applications (e.g. blogs

Re: Regular Expression

2007-10-22 Thread Marc 'BlackJack' Rintsch
On Mon, 22 Oct 2007 22:29:38 +, patrick.waldo wrote: > I'm trying to learn regular expressions, but I am having trouble with > this. I want to search a document that has mixed data; however, the > last line of every entry has something like C5H4N4O3 or CH5N3.ClH. > All of the letters are uppe

Re: for loop

2007-10-22 Thread [EMAIL PROTECTED]
On Oct 22, 5:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Oct 22, 5:22 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > > > > > > > On Mon, 22 Oct 2007 18:17:56 -0400, Shawn Minisall wrote: > > > #Intro > > > print "*" > > >

Re: parallel NumPy: PyMPI, myMPI or something else?

2007-10-22 Thread smithken04
Robert, the answer could not have been shorter, but I got exactly the information I was looking for :-) Thank you so much! Just a single followup question: > > Or do I have to split each problem myself to make use of the > > parallelism? > > Pretty much. Does "pretty much" imply that actually *som

Re: calling a function from string

2007-10-22 Thread Steven D'Aprano
On Mon, 22 Oct 2007 08:54:02 +, james_027 wrote: > hi, > > i have a function that I could like to call, but to make it more dynamic > I am constructing a string first that could equivalent to the name of > the function I wish to call. That is not the right solution to dynamic functions. The

Re: Iteration for Factorials

2007-10-22 Thread [EMAIL PROTECTED]
On Oct 22, 5:39 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > >> If obscurity is the name of the game, > > >>>>> from operator import mul > >>>>> fact = lambda i: i > 1 and reduce(mul, xrange(1,i+1)) or i > >> >= 0 and 1 or None > >>>>> for i in xrange(-2,10): print '%i! = %s' % (i, fact(

Re: calling a function from string

2007-10-22 Thread Steven D'Aprano
On Mon, 22 Oct 2007 23:16:38 +, Steven D'Aprano wrote: >> how could I call a_string as function? > > Others have suggested eval() and exec. Both will work, but have MAJOR > security implications. Oh, and they are seriously slower too. >>> import timeit >>> timeit.Timer('f("2.3")', ... 'f =

Re: Automatic Generation of Python Class Files

2007-10-22 Thread Steven Bethard
Bruno Desthuilliers wrote: > Steven Bethard a écrit : > (snip) >> In Python, you can use property() to make method calls look like >> attribute access. This could be necessary if you have an existing API >> that used public attributes, but changes to your code require those >> attributes to do

Re: parallel NumPy: PyMPI, myMPI or something else?

2007-10-22 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Robert, > the answer could not have been shorter, but I got exactly the > information I was looking for :-) > Thank you so much! > > Just a single followup question: >>> Or do I have to split each problem myself to make use of the >>> parallelism? >> Pretty much. > Does

web.py & postgresql error

2007-10-22 Thread dpholmes
hi everyone, i'm very new to python and to this forum. i'm actually just trying to work through the tutorial on webpy.org. so far, so good, but as i tried to incorporate a postgresql database into the demo web app i'm receiving this error print out: Traceback (most recent call last): File "/us

Can't Write to PostGIS PostGreSQL database via psycopg2

2007-10-22 Thread David Michael Schruth,
Hi, I am sort of in a jam here. I am using the PsycoPG2 library to read data out of a windows XP based PostGIS / PostGreSQL database but I am apparently unable to write (update or insert) even though I am able to read (select) I am using PsycoPG2 2.0.6 (psycopg2-2.0.6.win32-py2.5-pg8.2.4- releas

Re: Iteration for Factorials

2007-10-22 Thread Tim Chase
> Still, why do you want None instead of raisng an exception > (as is the case in other factorial implementations)? A null value is as good/bad as raising an exception in my book. Since you can't do math on a None object, any attempt to do so will raise an exception: >>> 42 + fact(-1) I genera

Python - why don't this script work?

2007-10-22 Thread Ohmster
I am trying to use this cool script that some MIT guy wrote and it just does not work, I get a stream of errors when I try to run it. It is supposed to visit a URL and snag all of the pictures on the site. Here is the script: http://web.mit.edu/pgbovine/www/image-harvester/image-harvester.py He

Re: for loop

2007-10-22 Thread Shawn Minisall
Thanks, everyone! Using everyone's suggestions and points, the program is working great now. Here's the updated code. :) import math def main(): #Declare and initialize variables #starting number of organisms organisms = 0 #average daily population increase as % increase =

Re: Python - why don't this script work?

2007-10-22 Thread Adam Atlas
On Oct 22, 9:47 pm, Ohmster <[EMAIL PROTECTED]> wrote: > I am trying to use this cool script that some MIT guy wrote and it just > does not work, I get a stream of errors when I try to run it. It is > supposed to visit a URL and snag all of the pictures on the site. Here is > the script:http://web.

Re: Python - why don't this script work?

2007-10-22 Thread John McMonagle
Ohmster wrote: > I am trying to use this cool script that some MIT guy wrote and it just > does not work, I get a stream of errors when I try to run it. It is > supposed to visit a URL and snag all of the pictures on the site. Here is > the script: > http://web.mit.edu/pgbovine/www/image-harvest

Re: Python - why don't this script work?

2007-10-22 Thread Daniel Larsson
Try: $ python image-harvester.py On 10/23/07, Ohmster <[EMAIL PROTECTED]> wrote: > > I am trying to use this cool script that some MIT guy wrote and it just > does not work, I get a stream of errors when I try to run it. It is > supposed to visit a URL and snag all of the pictures on the site. Her

Re: web.py & postgresql error

2007-10-22 Thread Erik Jones
On Oct 22, 2007, at 8:06 PM, [EMAIL PROTECTED] wrote: > hi everyone, i'm very new to python and to this forum. i'm actually > just trying to work through the tutorial on webpy.org. so far, so > good, but as i tried to incorporate a postgresql database into the > demo web app i'm receiving this e

Re: Can't Write to PostGIS PostGreSQL database via psycopg2

2007-10-22 Thread Erik Jones
On Oct 22, 2007, at 8:19 PM, David Michael Schruth, wrote: > Hi, > > I am sort of in a jam here. I am using the PsycoPG2 library to read > data out of a windows XP based PostGIS / PostGreSQL database but I am > apparently unable to write (update or insert) even though I am able to > read (select

Re: Python - why don't this script work?

2007-10-22 Thread Ohmster
Ohmster <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Here is my output when I try to run it on my Fedora 6 machine: > > [EMAIL PROTECTED] bench]$ image-harvester.py > http://public.fotki.com/DaGennelman/ > /home/ohmster/scripts/image-harvester.py: line 59: from: command not > found [E

Yank Bastards dont want to share with the European Bastards who dont want to share technology with Asia and Africa

2007-10-22 Thread thermate
Microsoft drops appeal of European antitrust case template_bas template_bas The software giant, which faces a $1 billion fine, will make some of its Windows operating system code available so developers can better design products for it. By Jim Puzzanghera, Los Angeles Times Staff Writer 11:43 AM P

Re: Python - why don't this script work?

2007-10-22 Thread J.O. Aho
Ohmster wrote: > Here is my output when I try to run it on my Fedora 6 machine: > [EMAIL PROTECTED] bench]$ image-harvester.py > http://public.fotki.com/DaGennelman/ > /home/ohmster/scripts/image-harvester.py: line 59: from: command not found Check line 59 in the python script and you see which c

The YANK Bastards and the ANGLO_SAXON RACE MOST EVIL RACE

2007-10-22 Thread thermate
Hiroshima,Nagasaki,Genocide in Australia and North America http://countercurrents.org/holt221007.htm It's The Oil By Jim Holt 22 October, 2007 London Review Of Books Iraq is 'unwinnable', a 'quagmire', a 'fiasco': so goes the received opinion. But there is good reason to think that, from the B

Re: for loop

2007-10-22 Thread [EMAIL PROTECTED]
On Oct 22, 9:12?pm, Shawn Minisall <[EMAIL PROTECTED]> wrote: > Thanks, everyone! Using everyone's suggestions and points, the program > is working great now. Actually, it's not. I assume not printing the population was a copy error. But, by adding the "if (p>1):", you have now made day 1 the

Re: Python - why don't this script work?

2007-10-22 Thread Ohmster
Steve Ackman <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: [snip] > Did you bother reading the comments? If you had, you'd > know that's not how you run it. > When run as directed (and common sense dictates), > it works fine. [snip] I figured it out, I have to run python I think fi

Re: Python - why don't this script work?

2007-10-22 Thread Ohmster
John McMonagle <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Your linux shell thinks it is running a shell script (from is not a > valid command in bash). > > To execute this script with the python interpreter type (from a shell > prompt): > > python image-harvester.py http://some.url.

Re: Python - why don't this script work?

2007-10-22 Thread Ohmster
"J.O. Aho" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Check line 59 in the python script and you see which command you are > missing. I bet you didn't read what it said on the page > http://web.mit.edu/pgbovine/www/image-harvester.htm > > Install the programs that mentioned on the pa

Re: Python - why don't this script work?

2007-10-22 Thread Ohmster
Adam Atlas <[EMAIL PROTECTED]> wrote in news:1193108392.089611.91170 @v29g2000prd.googlegroups.com: > I think you're executing it as a shell script. Run "python image- > harvester.py", or add "#!/usr/bin/env python" to the top of the file. > Hey that is a cool idea, I think I will try it. I foun

On 911 the FASCIST YANK AND ANGLO MOther Fuckers did a Heinous crime of killing 3000 people in a drama themselves

2007-10-22 Thread thermate
The time of fall The fake anthrax letters The absence of pentagon video, the most highly defended building The thermate residue The molten metal pools The pyroclastic flow of dust The shattering of the whole building into dust and small pieces The spherical particles of molten iron with sulfur, pot

On 911 the FASCIST YANK AND ANGLO MOther Fuckers did a Heinous crime of killing 3000 people in a drama themselves

2007-10-22 Thread thermate2
The time of fall The fake anthrax letters The absence of pentagon video, the most highly defended building The thermate residue The molten metal pools The pyroclastic flow of dust The shattering of the whole building into dust and small pieces The spherical particles of molten iron with sulfur, pot

Re: Check File Change Every 10 Seconds

2007-10-22 Thread Paul Rubin
"Robert Rawlins - Think Blue" <[EMAIL PROTECTED]> writes: > That certainly looks to be the type of thing that I'm looking to > achieve, however, I forgot to mention I'm running this on a Linux > platform and not a Win32 one :-( Sorry. If it's just one file, then yes, stat it in a loop with os.slee

Re: Committing latest patch on Issue 708374 to SVN (adding offset to mmap)

2007-10-22 Thread Paul Rubin
Travis Oliphant <[EMAIL PROTECTED]> writes: > I think the latest patch for fixing Issue 708374 (adding offset to > mmap) should be committed to SVN. I can't figure out what this is about from the issue tracker without examining the patch. It looks like the patch has been accepted; could you pleas

Monitoring external processes

2007-10-22 Thread arunasunil
Hi, Is there a way to track external processes launched by python on the Mac? I am using subprocess module to launch the process. Thanks Sunil -- http://mail.python.org/mailman/listinfo/python-list

Re: Iteration for Factorials

2007-10-22 Thread Mensanator
In a message dated 10/22/2007 8:46:59 PM Central Daylight Time, [EMAIL PROTECTED] writes: > > Still, why do you want None instead of raisng an exception > > (as is the case in other factorial implementations)? > > A null value is as good/bad as raising an exception in my book. > Since you can'

basic web auth and verification

2007-10-22 Thread [EMAIL PROTECTED]
Trying to figure out how to add login verfication. I believe it is logging me in, but theres no way to really tell..any ideas? or tutorials out there that can exaplain this to me? Thanks import urllib,urllib2,cookielib passlst = open(passfile, 'r').readlines() url="http://somesite"; cj = cookiel

decorator for a function without argument

2007-10-22 Thread [EMAIL PROTECTED]
hi: i have a decorator given below. def checkdb(web): def decorator(func): def proxyfunc(self, args=(), kw=None): #DO STUFF with web return func(self, *args, **kw) return proxyfunc return

Re: Monitoring external processes

2007-10-22 Thread Graham Dumpleton
On Oct 23, 3:09 pm, [EMAIL PROTECTED] wrote: > Hi, > > Is there a way to track external processes launched by python on the > Mac? I am using subprocess module to launch the process. > > Thanks > Sunil If using Python 2.3/2.4, you can use os.wait(). If using Python 2.5, there is also have os.wait

Re: ignoring chinese characters parsing xml file

2007-10-22 Thread Stefan Behnel
Fabian López wrote: > Thanks Mark, the code is like this. The attrib name is the problem: > > from lxml import etree > > context = etree.iterparse("file.xml") > for action, elem in context: > if elem.tag == "weblog": > print action, elem.tag , elem.attrib["name"],elem.attrib["url"],

<    1   2