Re: Importing an output from another function

2006-03-17 Thread James Stroud
Byte wrote: > Now what do I do if Func1() has multiple outputs and Func2() requires > them all to give its own output, as follows: > > import random > > def Func1(): > choice = ('A', 'B', 'C') > output = random.choice(choice) > output2 = random.choice(choice) > return output >

Re: Importing an output from another function

2006-03-17 Thread John Salerno
James Stroud wrote: > Try this (I think its called "argument expansion", but I really don't > know what its called, so I can't point you to docs): > > def Func1(): > choice = ('A', 'B', 'C') > output = random.choice(choice) > output2 = random.choice(choice) > return output, outpu

Re: Linear regression in NumPy

2006-03-17 Thread marek . rocki
nikie napisal(a): > I'm a little bit stuck with NumPy here, and neither the docs nor > trial&error seems to lead me anywhere: > I've got a set of data points (x/y-coordinates) and want to fit a > straight line through them, using LMSE linear regression. Simple > enough. I thought instead of looking

Re: Tried Ruby (or, "what Python *really* needs" or "perldoc!")

2006-03-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Terry Hancock wrote: >> Epydoc seems to be "dead" and pudge not yet alive: > > What leads you to this conclusion? Works pretty well for > me. Maybe it's just "stable"? But Docutils is a moving target and now and then the combination of both breaks and Epydoc doesn't get

python cgi permision error

2006-03-17 Thread [EMAIL PROTECTED]
Hi I have python cgi script, but when I call it I got server internal error. The log in my apache is [Sat Mar 18 04:17:14 2006] [error] [client 127.0.0.1] (13)Permission denied: exec of '/srv/www/cgi-bin/helo.cgi' failed [Sat Mar 18 04:17:14 2006] [error] [client 127.0.0.1] Premature end of scrip

Re: unicode error

2006-03-17 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > I have this python code: > print >> htmlFile, " style=\"width: 200px; height:18px;\">"; > > > But that caues this error, and I can't figure it out why. Any help is > appreicate > File "./run.py", line 193, in ? > print >> htmlFile, " style=\"width: 200px; height:18

Re: How to search XML? Are there special libs?

2006-03-17 Thread uche . ogbuji
Ravi Teja wrote: > Yes! XPath is a good bet. > You can also try some Pythonic XML libraries like Amara. You need not > learn any special language even. > > There are good database approaches to XML too, especially if you are > going to query a document collection as a whole rather than file by > fi

Re: Announcing atomfeed.py, xmlelements.py, and feedutils.py

2006-03-17 Thread uche . ogbuji
Steve R. Hastings wrote: > I have written some Python library modules to help with creating Atom > syndication feeds. Originally, I had a single module called "PyAtom"; now > I have split it up into three modules: xmlelements.py, atomfeed.py, and > feedutils.py. FWIW, see also Sylvain Hellegouar

Re: Python Evangelism

2006-03-17 Thread Douglas Alan
Andrew Gwozdziewycz <[EMAIL PROTECTED]> writes: > Douglas Alan wrote: >> Ruby didn't start catching on until Ruby on Rails came out. If >> Python has a naming problem, it's with the name of Django, rather >> than Python. Firstly, Django doesn't have "Python" in the name, so >> it doesn't popula

xmlrpclib and carriagereturn (\r)

2006-03-17 Thread Jonathan Ballet
Hello, I have developped a XMLRPC server, which runs under Gnu/Linux with python2.3. This server receives method calls from Windows client. The server got some parameters which are string, which contains carriage return characters, just after the line feed character; like "bla\n\rbla". The probl

Re: Importing an output from another function

2006-03-17 Thread James Stroud
John Salerno wrote: > James Stroud wrote: > >> Try this (I think its called "argument expansion", but I really don't >> know what its called, so I can't point you to docs): >> >> def Func1(): >> choice = ('A', 'B', 'C') >> output = random.choice(choice) >> output2 = random.choice(choi

Re: "pow" (power) function

2006-03-17 Thread David M. Cooke
"Russ" <[EMAIL PROTECTED]> writes: > Ben Cartwright wrote: >> Russ wrote: > >> > Does "pow(x,2)" simply square x, or does it first compute logarithms >> > (as would be necessary if the exponent were not an integer)? >> >> >> The former, using binary exponentiation (quite fast), assuming x is an >>

Re: My Generator Paradox!

2006-03-17 Thread Ron Adam
Robert Kern wrote: > vbgunz wrote: >> I believe I understand now. the yield keyword is sort of like a cousin >> to return. return will bring back an object I can work with and so does >> yield *but* yield's object will most likely support the .next() method. > > No, that's not really how it works.

Re: Xah's Edu Corner: The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully Functional Notations

2006-03-17 Thread Mike Schilling
"Roedy Green" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 17 Mar 2006 00:58:55 -0800, "Fuzzyman" <[EMAIL PROTECTED]> wrote, > quoted or indirectly quoted someone who said : > >>Hmmm... it displays fine via google groups. Maybe it's the reader which >>is 'non-compliant' ? > I

Python installation problem

2006-03-17 Thread [EMAIL PROTECTED]
I'm using OS X 10.4.5. I have an easy problem that I can't solve: I have two versions of python installed. 2.3 came with the OS and 2.4 I installed via fink. When I call python from the command-line it calls 2.4. When I just call a *.py file like test.py, it calls 2.3. 1. How do I make both thes

Re: Python installation problem

2006-03-17 Thread Kevin Walzer
[EMAIL PROTECTED] wrote: > > 1. How do I make both these kinds of calls work with 2.4. Try "/sw/bin/python foo.py" in the terminal and "#!/sw/bin/python" in your scripts. > 2. How do I uninstall v. 2.3 completely. Don't do that. It will break stuff in the OS that depends on Python. -- Kevin

Re: Python installation problem

2006-03-17 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > I'm using OS X 10.4.5. I have an easy problem that I can't solve: > I have two versions of python installed. 2.3 came with the OS and 2.4 I > installed via fink > 2. How do I uninstall v. 2.3 completely. Probably not the greatest idea, because pieces of OS X may actu

apache config file parser

2006-03-17 Thread David Bear
I was wondering if anyone has written an apache config file parser in python. There seem to be a number of perl mods to do this. But I don't seem to be able to find anything in python. -- David Bear -- let me buy your intellectual property, I want to own your thoughts -- -- http://mail.python.or

Re: Python installation problem

2006-03-17 Thread [EMAIL PROTECTED]
Thanks for the fast responses.>mp -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Documentation Standards

2006-03-17 Thread Colin J. Williams
Steven Bethard wrote: > Colin J. Williams wrote: > >> Doc strings provide us with a great opportunity to illuminate our code. >> >> In the example below, __init__ refers us to the class's documentation, >> but the class doc doesn't help much. > > > It doesn't? > > >>> print list.__doc__ > list

Re: python cgi permision error

2006-03-17 Thread David Bear
[EMAIL PROTECTED] wrote: > Hi > > I have python cgi script, but when I call it I got server internal > error. The log in my apache is > > [Sat Mar 18 04:17:14 2006] [error] [client 127.0.0.1] (13)Permission > denied: exec of '/srv/www/cgi-bin/helo.cgi' failed > [Sat Mar 18 04:17:14 2006] [error]

Re: Python installation problem

2006-03-17 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > I'm using OS X 10.4.5. I have an easy problem that I can't solve: > > I have two versions of python installed. 2.3 came with the OS and 2.4 I > installed via fink. That isn't the "proper" version. While it works, you certainly want the python 2.4 framework build. Tha

Dr. Dobb's Python-URL! - weekly Python news and links (Mar 17)

2006-03-17 Thread Cameron Laird
QOTW: "Generally, you should always go for whatever is clearest/most easily read (not just in Python, but in all languages)." - Timothy Delaney "You will find as your programming experience increases that the different languages you learn are appropriate for different purposes, and have differen

Re: Importing an output from another function

2006-03-17 Thread John Salerno
James Stroud wrote: > Yours is better, after I wrote mine, I realized the asterisk was > unnecessary for this particular example, except that it makes Func2 more > general. Yeah, I tested it. Func2 prints a tuple of a tuple when the asterisk is used. But your generator still wins. :) -- http

Re: Need design advice. What's my best approach for storing this data?

2006-03-17 Thread Mudcat
>On a different tack, to avoid thinking about any db issues, consider >subscribing >to TC2000 (tc2000.com)... they already have all that data, >in a database which takes about 900Mb when fully installed. That is an interesting option also. I had actually looked for ready made databases and didn't

Re: Importing an output from another function

2006-03-17 Thread James Stroud
John Salerno wrote: > James Stroud wrote: > > Try this (I think its called "argument expansion", but I really don't > know what its called, so I can't point you to docs): > > def Func1(): > choice = ('A', 'B', 'C') > output = random.choice(choice) > output2 = random.choice(choice) > return output

Re: Linear regression in NumPy

2006-03-17 Thread nikie
I still don't get it... My data looks like this: x = [0,1,2,3] y = [1,3,5,7] The expected output would be something like (2, 1), as y[i] = x[i]*2+1 (An image sometimes says more than 1000 words, so to make myself clear: this is what I want to do: http://www.statistics4u.info/fundstat_eng/cc_regr

Re: Linear regression in NumPy

2006-03-17 Thread Robert Kern
nikie wrote: > I still don't get it... > My data looks like this: > x = [0,1,2,3] > y = [1,3,5,7] > The expected output would be something like (2, 1), as y[i] = x[i]*2+1 > > (An image sometimes says more than 1000 words, so to make myself clear: > this is what I want to do: > http://www.statist

Re: Python compiler

2006-03-17 Thread DaveM
On Thu, 16 Mar 2006 13:34:14 +0100, "Méta-MCI" <[EMAIL PROTECTED]> wrote: >Après, vous pourrez aussi fréquenter le newsgroup : >fr.comp.lang.python >qui a l'avantage d'être en français. But perhaps he's a Flemish speaker - are you trying to start a riot? DaveM -- http://mail.python.org/

Python execution problem

2006-03-17 Thread [EMAIL PROTECTED]
Using OSX 10.4.5 This is more of a unix/tcsh question than a python question. Somehow I got to the point where I have two files 'a.py' and 'b.py' which have identical contents and permissions, but one refuses to execute: [blah:/Library/WebServer/CGI-Executables] me% a.py tcsh: a.py: Command not f

SVD question

2006-03-17 Thread smritibhagat
Hi! I have been trying to figure this out, and need help... How do I compute an orthogonal complement of a matrix using SVD? Is there a python lib function or code that does this? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: style guideline for naming variables?

2006-03-17 Thread Duncan Smith
John Salerno wrote: > After reading the PEP, I'm still not quite sure if there is a > recommended (or widely preferred) method of naming variables. Here are > the relevant bits: > >> Global Variable Names >> >> (Let's hope that these variables are meant for use inside one >> module >>

Re: SVD question

2006-03-17 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Hi! > I have been trying to figure this out, and need help... > How do I compute an orthogonal complement of a matrix using SVD? On the chance that this is homework, I will only point out that Golub and van Loan's book _Matrix Computations_ is essential reading if you ar

Re: Very, Very Green Python User

2006-03-17 Thread hanumizzle
Dhanyavaad (thank you) -- http://mail.python.org/mailman/listinfo/python-list

Re: My Generator Paradox!

2006-03-17 Thread vbgunz
OK. I hope my understanding of the yield keyword and generators in a general sense are now better understood. When a generator function is assigned to an identifier, no code is executed and a generator is immediately returned. When the next() method is called on the new generator, code from top to

Re: Python Evangelism

2006-03-17 Thread John Pote
If I get time I'll expand my thoughts and experiences but for now, Don't know what Ruby on Rails is but it's catchy and current high volume of interest makes me think - I should look into it. Django, skip reading this thread before and I had not even picked up it was a Python product (still don'

Re: Importing an output from another function

2006-03-17 Thread Terry Hancock
On 17 Mar 2006 12:15:28 -0800 "Byte" <[EMAIL PROTECTED]> wrote: > Probably a stupid question, but I'm a newbie and this > really pisses me off. Run this script: > > import random > > def Func1(): > choice = ('A', 'B', 'C') > output = random.choice(choice) > > def Func2(): > print out

insert chars into string

2006-03-17 Thread eight02645999
hi is there a string method to insert characters into a string? eg str = "abcdef" i want to insert "#" into str so that it appears "abc#def" currently what i did is convert it to a list, insert the character using insert() and then join them back as string.. thanks -- http://mail.python.org/mai

Re: insert chars into string

2006-03-17 Thread Felipe Almeida Lessa
Em Sex, 2006-03-17 às 17:32 -0800, [EMAIL PROTECTED] escreveu: > is there a string method to insert characters into a string? As far as I know, no. Strings are immutable in Python. That said, the following method may do what you want: def insert(original, new, pos): '''Inserts new inside

Re: Importing an output from another function

2006-03-17 Thread Paul Rubin
"Byte" <[EMAIL PROTECTED]> writes: > Probably a stupid question, but I'm a newbie and this really pisses me > off. Run this script: > > import random > > def Func1(): > choice = ('A', 'B', 'C') > output = random.choice(choice) > > def Func2(): > print output > > Func1() > Func2() Y

Re: SVD question

2006-03-17 Thread smritibhagat
Hi Robert! Oh! Its not a homework problem... I read the Golub book, it tells me what an orthogonal complement is, however, I cannot understand how I can code it. I know about svd from numpy's mlab, but I what I want to know is how can I compute an orthogonal complement, using SVD or otherwise. Than

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-17 Thread Kaz Kylheku
[EMAIL PROTECTED] wrote: > The wildcard exclusion problem is interesting enough to have many > distinct, elegant solutions in as many languages. In that case, you should have crossposted to comp.lang.python also. Your program looks like a dog's breakfast. -- http://mail.python.org/mailman/listi

message box halts prgram flow

2006-03-17 Thread linuxnooby
HI I am creating a tkinter app. example tkMessageBox.showinfo("Window Text", "A short message") print "blah" The execution of the application halts when the message box is displayed until the user clicks OK, then "blah is printed. However I want the program to display message box and continue

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-17 Thread funkyj
[EMAIL PROTECTED] wrote: > It would seem that your program is just filtering the full cartesian > product, right? The solution I'm looking for generates the elements > one-by-one so that it could be used in a loop. One advantage of a generator over filtering the full product is that I, as the user

Re: SVD question

2006-03-17 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Hi Robert! > Oh! Its not a homework problem... > I read the Golub book, it tells me what an orthogonal complement is, > however, I cannot understand how I can code it. > I know about svd from numpy's mlab, but I what I want to know is how > can I compute an orthogonal com

MPI implementations

2006-03-17 Thread Daniel Nogradi
I plan to use python parallel and -- fortunately or unfortunately -- there are several implementations. At the moment I'm aware of http://datamining.anu.edu.au/~ole/pypar/ http://pympi.sourceforge.net/ http://www.fysik.dtu.dk/~schiotz/comp/PythonAndSwig/pythonMPI.html and wondered if anyone had e

Re: Python execution problem

2006-03-17 Thread Jeffrey Schwab
[EMAIL PROTECTED] wrote: > Using OSX 10.4.5 > > This is more of a unix/tcsh question than a python question. > Somehow I got to the point where I have two files 'a.py' and 'b.py' > which have identical contents and permissions, but one refuses to > execute: > > [blah:/Library/WebServer/CGI-Execut

Re: Use of Python with GDAL. How to speed up ?

2006-03-17 Thread Serge Orlov
Julien Fiore wrote: > Hi, > I wrote a function to compute openness (a digital elevation model > attribute). The function opens the gdal-compatible input raster and > reads the values in a square window around each cell. The results are > stored in a "1 line buffer". At the end of the line, the buff

Python equivalent of Perl-ISAPI?

2006-03-17 Thread rurpy
Is there an effcient way (more so than cgi) of using Python with Microsoft IIS? Something equivalent to Perl-ISAPI? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs. Java gzip performance

2006-03-17 Thread Andrew MacIntyre
Bill wrote: > I've written a small program that, in part, reads in a file and parses > it. Sometimes, the file is gzipped. The code that I use to get the > file object is like so: > > if filename.endswith(".gz"): > file = GzipFile(filename) > else: > file = open(filename) > > Then I par

Re: python cgi permision error

2006-03-17 Thread devilandme
> > assuming you are running this python script the standard cgi way and not > through modpython or fastcgi. yes I'm running it in standard cgi way coz my provider only allow me that way. And it's really just simple script. Sorry for the dumb question, I know modpython but what do you mean by fast

Re: Python vs. Java gzip performance

2006-03-17 Thread Serge Orlov
Bill wrote: > Is there something that can be improved in the Python version? Seems like GzipFile.readlines is not optimized, file.readline works better: C:\py>python -c "file('tmp.txt', 'w').writelines('%d This is a test\n' % n for n in range(1))" C:\py>python -m timeit "open('tmp.txt').read

remove a directory with special chars

2006-03-17 Thread s99999999s2003
hi i have a filen with a funny name like \177\177. I guess someone hit backspace or something before saving it. It's hidden and it shows when i type ls with the -b switch on unix. How can i remove this file using python? thanks -- http://mail.python.org/mailman/listinfo/python-list

remove a directory with special chars

2006-03-17 Thread s99999999s2003
hi i have a filen with a funny name like \177\177. I guess someone hit backspace or something before saving it. It's hidden and it shows when i type ls with the -b switch on unix. How can i remove this file using python? -- http://mail.python.org/mailman/listinfo/python-list

Have you ever considered of mousing ambidextrously?

2006-03-17 Thread WangQiang
I'm also a programmer, as working in front of computer day and day, my right hand is so tired and ached. So I tried to mouse in both hands. I find that it is really an efficient way to release pains. At first I switched the mouse buttons in windows control panel, but it taked me several steps to fi

Re: My Generator Paradox!

2006-03-17 Thread Ron Adam
vbgunz wrote: > OK. I hope my understanding of the yield keyword and generators in a > general sense are now better understood. When a generator function is > assigned to an identifier, no code is executed and a generator is > immediately returned. When the next() method is called on the new > gene

Re: Importing an output from another function

2006-03-17 Thread Ben Cartwright
James Stroud wrote: > Try this (I think its called "argument expansion", but I really don't > know what its called, so I can't point you to docs): > > def Func1(): > choice = ('A', 'B', 'C') > output = random.choice(choice) > output2 = random.choice(choice) > return output, outp

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-17 Thread Doug Quale
"funkyj" <[EMAIL PROTECTED]> writes: > One advantage of a generator over filtering the full product is that I, > as the user of the generator, am not obligated to iterate over the > entire solution space. > > Are there other _practical_ advantages of generators over mapping & > filtering complete

Re: Using yacas within Python for symbolis computation

2006-03-17 Thread Mudcat
Out of curiosity, are you also Texas Longhorn JCDenton in another online life? -- http://mail.python.org/mailman/listinfo/python-list

Python 2.5 Schedule

2006-03-17 Thread [EMAIL PROTECTED]
For more details about the plan for Python 2.5, see: http://www.python.org/doc/peps/pep-0356/ The highlights are that we are hoping to put out the first alpha Real Soon Now, hopefully in a week or two. If there's something you really think just must be in 2.5 and can't wait until 2.6, now is

Re: xmlrpclib and carriagereturn (\r)

2006-03-17 Thread Fredrik Lundh
Jonathan Ballet wrote: > The problem is, xmlrpclib "eats" those carriage return characters when > loading the XMLRPC request, and replace it by "\n". So I got "bla\n\nbla". > > When I sent back those parameters to others Windows clients (they are > doing some kind of synchronisation throught the X

<    1   2