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

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: 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

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: 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: 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

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

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

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

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

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 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

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: 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

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

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: 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

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

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 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

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: 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: 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

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: 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

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: 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: Very, Very Green Python User

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

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: 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 >>

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

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

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/

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: 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: 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: 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 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

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: 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

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 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 installation problem

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

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 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

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

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: 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

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: "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: 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

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: 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

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: 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: 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

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: 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

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: 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: 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: Python vs. Java gzip performance

2006-03-17 Thread Peter Otten
Caleb Hattingh wrote: > I tried this: > > from timeit import * > > #Try readlines > print Timer('import > gzip;lines=gzip.GzipFile("gztest.txt.gz").readlines();[i+"1" for i in > lines]').timeit(200) # This is one line > > > # Try file object - uses buffering? > print Timer('import gzip;[i+"1"

Re: Counting nested loop iterations

2006-03-17 Thread Scott David Daniels
Duncan Booth wrote: > Oh well, just wait until Python 2.5 comes out and we get people complaining > about the order of the new if statement. Or rather, the order of the new if _expression_. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: My Generator Paradox!

2006-03-17 Thread Robert Kern
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. When a generator function i

Re: Importing an output from another function

2006-03-17 Thread John Salerno
Byte wrote: > Now what do I do if Func1() has multiple outputs and Func2() requires > them all to give its own output, as follows: You can return them as a tuple: >>> def func1(): output1 = 'hi' output2 = 'bye' return (output1, output2) >>> def func2(data): prin

Re: Linear regression in NumPy

2006-03-17 Thread Robert Kern
nikie wrote: > 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 up t

No module named glade?

2006-03-17 Thread Terry Hancock
I've run into something a little odd on my Debian-installed Python 2.3. I have deb packages "python2.3", "python-gtk2", and "python2.3-glade2" installed on this machine. Among other things, these DO give me the following (verified): /usr/lib/python2.3/site-packages/pygtk.pth /usr/lib/python2.3/s

Re: Importing an output from another function

2006-03-17 Thread Byte
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 return output2 def Func2(item1,

Linear regression in NumPy

2006-03-17 Thread nikie
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 up the formulas I'd just se

Re: Importing an output from another function

2006-03-17 Thread Byte
Great, thanks -- /usr/bin/byte -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing Hints

2006-03-17 Thread Kent Johnson
mwt wrote: > Hi - > I'm working on parsing a file that has data that looks like the sample > below. > > Here's a sample of the data: > > Index 4: folding now > server: 171.65.199.158:8080; project: 1809 > Folding: run 17, clone 19, generation 35; benchmark 669; misc: 500, > 400 > issue: W

Re: Parsing Hints

2006-03-17 Thread mwt
OK. I think the solution was much easier than I thought. The key is the semicolon. I'm doing it in 3 steps: 1) Break string into 13 lines 2) Split each line by the semi-colon 3) Ummm... done already. Time to wake up. ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there no end to Python?

2006-03-17 Thread sjmsoft
John Salerno wrote: > But isn't Python sort of known for the opposite, i.e. 'one simple way', > or something to that effect? The Python language is clear and concise and so I don't think takes long to learn. But there's so many libraries and packages available that I'll probably never use more th

Re: Problem with C-API

2006-03-17 Thread John Dean
Hi Duncan's example worked to a point. The line PyRun_String( "print x", Py_file_input, dict, dict); print out the contents of x, but I don't want to print x out. I want to be able to grab whateven the variable x contains so that I can pass it on for further processing by the C++ application. BTW

Re: Importing an output from another function

2006-03-17 Thread bearophileHUGS
Generally, a name defined into a function can't be read outside of it, so you have to return the function result explicitely: import random def Func1(): choice = ('A', 'B', 'C') output = random.choice(choice) return output def Func2(item): print item output1 = Func1() Func2(outp

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

2006-03-17 Thread Caleb Hattingh
Hi The documentation for the python profiler in the python library reference is extremely readable (well done James Roskin!?). Profile your code, and when you find where the speed problem occurs, try pitching just that section of code in comp.lang.python. You will likely get much feedback. Ever

Re: Problem with C-API

2006-03-17 Thread John Dean
Hi Duncan Your version of the app works apart from this part else { PyObject *rString = PyObject_Str(result); if (rString==NULL) { Py_DECREF(result); PyErr_Print(); return; } printf( "The result is %s\n", PyStr

Re: unicode error

2006-03-17 Thread jean-michel bain-cornu
[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

Importing an output from another function

2006-03-17 Thread Byte
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() And: an error message.. It says: Traceback (most recent cal

Re: Python vs. Java gzip performance

2006-03-17 Thread Caleb Hattingh
I tried this: from timeit import * #Try readlines print Timer('import gzip;lines=gzip.GzipFile("gztest.txt.gz").readlines();[i+"1" for i in lines]').timeit(200) # This is one line # Try file object - uses buffering? print Timer('import gzip;[i+"1" for i in gzip.GzipFile("gztest.txt.gz")]').time

Re: style guideline for naming variables?

2006-03-17 Thread John Salerno
John Salerno wrote: > some_function > > But this seems awkward to me. someFunction seems nicer Sorry, I was asking about variables but used a function example. But really I'm asking about any situation where you might want to use multiple words (except for classes, which is recommended to use

style guideline for naming variables?

2006-03-17 Thread John Salerno
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 > only.) The conventions are abou

Re: My Generator Paradox!

2006-03-17 Thread vbgunz
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. So, if I worked with a function that ends with the return keyword and it returns a

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

2006-03-17 Thread PofN
Dinko Tenev wrote: > If only someone could persuade this guy to stay away from CS... I still hope that at some point in time he will manage to tender his nomination for the darvin award. You can't rationalize with that troll, because there is nothing between his ears capable of catching a clue. -

Re: Is there no end to Python?

2006-03-17 Thread Mark Warburton
John Salerno wrote: > > But isn't Python sort of known for the opposite, i.e. 'one simple way', > or something to that effect? Ha! I was thinking the same thing. But then I realized this only applies at the microscopic level. If you're doing something like reversing the order of the elements in

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

2006-03-17 Thread Roedy Green
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 am using Agent. You configure your database with an encoding, which is by default t

Re: Is there no end to Python?

2006-03-17 Thread Kamilche
Because Python doesn't take as many CPU cycles in your brain, it spares more time for 'big picture' ideas, such as the event handling framework I'm working on. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs. Java gzip performance

2006-03-17 Thread Martin v. Löwis
Bill wrote: > The Java version of this code is roughly 2x-3x faster than the Python > version. I can get around this problem by replacing the Python > GzipFile object with a os.popen call to gzcat, but then I sacrifice > portability. Is there something that can be improved in the Python > version

Re: Is there no end to Python?

2006-03-17 Thread John Salerno
Kamilche wrote: > in PyGame, and I've programmed up 4 ways to do it so far, and have a > couple more waiting to be done! Python is so amazingly flexible, it > will happily accommodate whatever I manage to spew forth as my event > handling system. > > It really fires the imagination. In other lang

Is there no end to Python?

2006-03-17 Thread Kamilche
I have been programming in Python for years, and I'm STILL learning new features about the language. I'm looking for the best way to handle events with my own UI developed in PyGame, and I've programmed up 4 ways to do it so far, and have a couple more waiting to be done! Python is so amazingly fl

Parsing Hints

2006-03-17 Thread mwt
Hi - I'm working on parsing a file that has data that looks like the sample below. Obviously, I can't just split the string by colons. I'm pretty new to regex, but I was thinking of something that would essentially "split" by colons only if the are preceded by alpha characters -- thus eliminating p

Re: Computing correlations with SciPy

2006-03-17 Thread Travis Oliphant
[EMAIL PROTECTED] wrote: > I want to compute the correlation between two sequences X and Y, and > tried using SciPy to do so without success.l Here's what I have, how > can I correct it? > This was a bug in NumPy (inherited from Numeric actually). The fix is in SVN of NumPy. Here are the new v

Re: Python poly obsolete?

2006-03-17 Thread Georg Brandl
Thierry Lam wrote: > I have a piece of python code which goes like the following: > > import poly > > list = [1, 2, 3] > > result = poly.scan(list) > > I'm using Python 2.3.4 and I don't think that poly library is working > properly, I read somewhere that's it's obsolete now. What's the > alter

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

2006-03-17 Thread Rene Pijlman
Mudcat: >My initial thought was to put the data in large dictionaries and shelve >them (and possibly zipping them to save storage space until the data is >needed). However, these are huge files. ZODB solves that problem for you. http://www.zope.org/Wikis/ZODB/FrontPage More in particular "5.3 BTr

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-17 Thread Alan Crowe
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > What I have in mind is the efficient, generation of the > complement S^n/WC(S^n). A good program should initialize, generate, and > terminate. > > T=cartprodex(S,n,WC); //initialize > for all i in T do > what you want with i > test to see if

Re: Is there a python library to parse C++ code file?

2006-03-17 Thread Roman Yakovenko
On 3/17/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > Is there a python library to parse C++ code file? > > If yes, can you please tell me where is it? pygccxml. http://www.language-binding.net/pygccxml/pygccxml.html Very powerful package :-)! It has built-in supp

Re: Problem with C-API

2006-03-17 Thread Duncan Booth
John Dean wrote: > PyRun_String("def title();", Py_file_input, dict, dict); > PyRun_String("\treturn 'Foo Bar'", Py_file_input, dict, dict); > PyRun_String("x = title()", Py_file_input, dict, dict); > PyObject * result = PyRun_String("print x", Py_file_input, dict, dict); > printf( "The result is

unicode error

2006-03-17 Thread Allerdyce . John
I have this python code: print >> htmlFile, ""; 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, ""; UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 9: ordinal not in range(128) Thanks.

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-17 Thread Geoffrey Summerhayes
Wade Humeniuk wrote: > [EMAIL PROTECTED] wrote: > > What I have in mind is the efficient, generation of the > > complement S^n/WC(S^n). A good program should initialize, generate, and > > terminate. > > > > T=cartprodex(S,n,WC); //initialize > > for all i in T do > > what you want with i > >

Re: accessing a USB HID

2006-03-17 Thread jodansmif
Thanks! I'll get cranking along and post my progress to the thread. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >