Re: psycopg2 and large queries

2008-12-18 Thread Laszlo Nagy
They do have a description attribute, but it is only populated after you fetch a row. eg try cur = conn.cursor(name='mycursor') cur.execute('select name from blah') cur.fetchone() print cur.description Oh, great. I should have known. Thanks. Maybe I can live with psycopg2, because combining

Re: Factoring Polynomials

2008-12-18 Thread Terry Reedy
Collin D wrote: UPDATE: ' #import from math import sqrt # collect data a = float(raw_input('Type a value: ')) b = float(raw_input('Type b value: ')) c = float(raw_input('Type c value: ')) # create solver def solver(a,b,c): if b**2 - 4*a*c < 0: return 'No real solution.' else:

Re: Python lex settings

2008-12-18 Thread Sergey Shepelev
On Dec 19, 2:16 am, Robert Kern wrote: > Sergey Shepelev wrote: > > Hello. > > > I'm trying to make almost-Python source to Erlang source translation > > tool. > > > Are there ready ply.lex settings for parsing python source? > > Yes! Andrew Dalke has implemented a PLY grammar for Python for exper

Re: Very Slow PythonWin 2.6.1 Startup on Windows XP SP3

2008-12-18 Thread MC
Hi! Perhaps, if you copy DLL in others strategic places, it's better... -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: eval() and global variables

2008-12-18 Thread Juan Pablo Romero Méndez
The hack given by Peter works fine, except in this case: >>> def (fn): ... f2 = lambda x,y:(x,y,fn(x,y)) ... function = type(f2) ... f3 = function(f2.func_code,dict()) ... print f3 ... >>> (lambda x,y:x+y) Traceback (most recent call last): File "", line 1, in File "",

Re: Is this pythonic?

2008-12-18 Thread Hendrik van Rooyen
"Bruno Desthuilliers" wrote: >ipyt...@gmail.com a écrit : >> x.validate_output(x.find_text(x.match_filename >> (x.determine_filename_pattern(datetime.datetime.now() >> >> Is it even good programming form? > >functional programming addicts might say yes. But as far as I'm >concerned, I find it

Re: Python for amd64 and mingw-w64

2008-12-18 Thread Martin v. Löwis
> - Any extension requires the MS_WIN64 to be defined, but this symbol > is only defined for MS compiler (in PC/pyport.h). Why do you say that? It is only defined when _WIN64 is defined; this has nothing to do with a MS compiler. > Shouldn't it be > defined independantly of the compiler ? You m

Re: Factoring Polynomials

2008-12-18 Thread Scott David Daniels
James Mills wrote: No worries. Please take an hour or two to go through the Python Tutorial at http://docs.python.org/ I'll bet is been more than a couple of days since you (James) ran through the tutorial. It is absolutely worth going through, but _nobody_ should imagine they are slow if the

Openings for Release Management

2008-12-18 Thread Priya Ranjith
Position: Build and Release Engineer Experience Required: 2 - 7 yrs Qualification: B.E/M.E/M.C.A/B.Tech Skills Required: 1) Working experience in distributed version control system like Mercurial / Bazar / GIT or Subversion 2) Experience in RBuilder 3) Working experience in creating software a

Openings for Release Management

2008-12-18 Thread Priya Ranjith
Position: Build and Release Engineer Experience Required: 2 - 7 yrs Qualification: B.E/M.E/M.C.A/B.Tech Skills Required: 1) Working experience in distributed version control system like Mercurial / Bazar / GIT or Subversion 2) Experience in RBuilder 3) Working experience in creating software a

Openings for Release Management

2008-12-18 Thread Priya Ranjith
Position: Build and Release Engineer Experience Required: 2 - 7 yrs Qualification: B.E/M.E/M.C.A/B.Tech Skills Required: 1) Working experience in distributed version control system like Mercurial / Bazar / GIT or Subversion 2) Experience in RBuilder 3) Working experience in creating software a

Very Slow PythonWin 2.6.1 Startup on Windows XP SP3

2008-12-18 Thread David Lees
PythonWin used to startup in a second or two on my Windows XP desktop. now it takes around 20 seconds. I tried turning off Google Desktop indexing and Norton AV, but it still takes a long time to start. Other random apps such as Firefox 3.0 (which I just updated to) and Thunderbird have norma

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Carl Banks
On Dec 18, 9:53 am, "Diez B. Roggisch" wrote: > Neal Becker wrote: > > Diez B. Roggisch wrote: > > >> Neal Becker wrote: > > >>> Tino Wildenhain wrote: > > Neal Becker wrote: > ... > >>> So if __str__ is "meant for human eyes", then why isn't print using > >>> it! > >> it is:

Python for amd64 and mingw-w64

2008-12-18 Thread David Cournapeau
Hi, I want to build python extensions with mingw-w64 on windows 64 bits. I found some problems which I think are python bugs/deficiencies, but would like a confirmation: - Any extension requires the MS_WIN64 to be defined, but this symbol is only defined for MS compiler (in PC/pyport.h). Shouldn

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Russ P.
On Dec 18, 1:27 pm, Robert Kern wrote: > Mikael Olofsson wrote: > > Diez B. Roggisch wrote: > >> Yep. And it's easy enough if you don't care about them being different.. > > >> def __repr__(self): > >>     return str(self) > > > If I ever wanted __str__ and __repr__ to return the same thing, I wou

Re: Is this pythonic?

2008-12-18 Thread Russ P.
On Dec 18, 8:08 am, ipyt...@gmail.com wrote: > x.validate_output(x.find_text(x.match_filename > (x.determine_filename_pattern(datetime.datetime.now() > > Is it even good programming form? I hope you're kidding. -- http://mail.python.org/mailman/listinfo/python-list

Re: Factoring Polynomials

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 12:48 PM, Collin D wrote: > UPDATE: > > #import > from math import sqrt > > # collect data > a = float(raw_input('Type a value: ')) > b = float(raw_input('Type b value: ')) > c = float(raw_input('Type c value: ')) > > # create solver > def solver(a,b,c): >disc = b**2 -

Re: Factoring Polynomials

2008-12-18 Thread Collin D
On Dec 18, 6:41 pm, "Russ P." wrote: > On Dec 18, 6:31 pm, Collin D wrote: > > > > > > > On Dec 18, 6:27 pm, Collin D wrote: > > > > On Dec 18, 6:23 pm, "Russ P." wrote: > > > > > On Dec 18, 6:17 pm, Collin D wrote: > > > > > > On Dec 18, 6:12 pm, Collin D wrote: > > > > > > > On Dec 18, 11:3

Re: Factoring Polynomials

2008-12-18 Thread Russ P.
On Dec 18, 6:41 pm, "Russ P." wrote: > On Dec 18, 6:31 pm, Collin D wrote: > > > > > On Dec 18, 6:27 pm, Collin D wrote: > > > > On Dec 18, 6:23 pm, "Russ P." wrote: > > > > > On Dec 18, 6:17 pm, Collin D wrote: > > > > > > On Dec 18, 6:12 pm, Collin D wrote: > > > > > > > On Dec 18, 11:37 am

Re: Factoring Polynomials

2008-12-18 Thread Russ P.
On Dec 18, 6:31 pm, Collin D wrote: > On Dec 18, 6:27 pm, Collin D wrote: > > > > > On Dec 18, 6:23 pm, "Russ P." wrote: > > > > On Dec 18, 6:17 pm, Collin D wrote: > > > > > On Dec 18, 6:12 pm, Collin D wrote: > > > > > > On Dec 18, 11:37 am, collin.da...@gmail.com wrote: > > > > > > > I am t

python mysql hash generator

2008-12-18 Thread Matías Hernández
sorry for my english, but i'm speak spanish) Hi list.. this is my first post... and obviously if for help.. I try to implement the password function of mysql in a python script. I read that the password function of mysql was implemented with a double sha1() I python i try this: example1: if __n

Re: Factoring Polynomials

2008-12-18 Thread Collin D
On Dec 18, 6:27 pm, Collin D wrote: > On Dec 18, 6:23 pm, "Russ P." wrote: > > > > > > > On Dec 18, 6:17 pm, Collin D wrote: > > > > On Dec 18, 6:12 pm, Collin D wrote: > > > > > On Dec 18, 11:37 am, collin.da...@gmail.com wrote: > > > > > > I am trying to write a simple application to factor p

Re: Factoring Polynomials

2008-12-18 Thread Collin D
On Dec 18, 6:23 pm, "Russ P." wrote: > On Dec 18, 6:17 pm, Collin D wrote: > > > > > > > On Dec 18, 6:12 pm, Collin D wrote: > > > > On Dec 18, 11:37 am, collin.da...@gmail.com wrote: > > > > > I am trying to write a simple application to factor polynomials. I > > > > wrote (simple) raw_input li

Re: Factoring Polynomials

2008-12-18 Thread Russ P.
On Dec 18, 6:17 pm, Collin D wrote: > On Dec 18, 6:12 pm, Collin D wrote: > > > > > On Dec 18, 11:37 am, collin.da...@gmail.com wrote: > > > > I am trying to write a simple application to factor polynomials. I > > > wrote (simple) raw_input lines to collect the a, b, and c values from > > > the u

Re: Factoring Polynomials

2008-12-18 Thread Collin D
On Dec 18, 6:12 pm, Collin D wrote: > On Dec 18, 11:37 am, collin.da...@gmail.com wrote: > > > I am trying to write a simple application to factor polynomials. I > > wrote (simple) raw_input lines to collect the a, b, and c values from > > the user, but I dont know how to implement the quadratic e

Re: Factoring Polynomials

2008-12-18 Thread Collin D
On Dec 18, 11:37 am, collin.da...@gmail.com wrote: > I am trying to write a simple application to factor polynomials. I > wrote (simple) raw_input lines to collect the a, b, and c values from > the user, but I dont know how to implement the quadratic equation > > x = (-b +or- (b^2 - 4ac)^1/2) / 2a

Re: Factoring Polynomials

2008-12-18 Thread Steven D'Aprano
On Thu, 18 Dec 2008 17:42:28 -0800, Collin D wrote: > The corrected function is: > def quadratic_solution(a,b,c) > sol1 = -1*b + ((b**2 - 4*a*c)**.5)/2*a > sol1 = -1*b - ((b**2 - 4*a*c)**.5)/2*a > return (sol1, sol2) > > Squaring the -b would give you some strange solutions :D

Re: psycopg2 and large queries

2008-12-18 Thread alito
On Dec 19, 2:34 am, Laszlo Nagy wrote: > > I was looking for psycopg2 documentation, but I found nothing. However, > I found some posts telling that named cursors do support fetching a > single row at a time. Here is how to create a named cursor: > > cur = conn.cursor('mycursor') > > This is very

Re: Factoring Polynomials

2008-12-18 Thread Steven D'Aprano
On Fri, 19 Dec 2008 01:10:28 +, Steven D'Aprano wrote: > Because this looks like homework... Homework or not, of course others have answered it completely, more or less error-free. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: re.match() performance

2008-12-18 Thread Steven D'Aprano
On Thu, 18 Dec 2008 05:51:33 -0800, Emanuele D'Arrigo wrote: > I've written the code below to test the differences in performance ... > ## TIMED FUNCTIONS > startTime = time.clock() > for i in range(0, numberOfRuns): > re.match(pattern, longMessage) > patternMatchingTime = time.clock() - start

Re: subprocess.Popen inheriting

2008-12-18 Thread Aaron Brady
On Dec 18, 6:11 pm, "Gabriel Genellina" wrote: > En Thu, 18 Dec 2008 08:35:58 -0200, Aaron Brady > escribió: > > > > > On Dec 17, 7:16 pm, "Gabriel Genellina" > > wrote: > >> En Wed, 17 Dec 2008 22:46:32 -0200, Aaron Brady   > >> escribió: > > >> > On Dec 17, 5:05 pm, "Gabriel Genellina" > >>

Re: Factoring Polynomials

2008-12-18 Thread Collin D
On Dec 18, 5:10 pm, Steven D'Aprano wrote: > On Thu, 18 Dec 2008 11:37:35 -0800, collin.day.0 wrote: > > I am trying to write a simple application to factor polynomials. I wrote > > (simple) raw_input lines to collect the a, b, and c values from the > > user, but I dont know how to implement the q

Re: Factoring Polynomials

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 11:37 AM, Collin D wrote: > Ahh. Great.. that answers a lot of questions. > Originally I was using just a = raw_input('a: ') > And was getting errors because you cant perform mathmatical operations > on strings. >.< > Thanks again! No worries. Please take an hour or two to

Re: Factoring Polynomials

2008-12-18 Thread Collin D
On Dec 18, 5:30 pm, "James Mills" wrote: > UPDATE: > > jmi...@atomant:~/tmp$ cat polycalc.py > #!/usr/bin/env python > > from math import sqrt > > def f(a, b, c): >     if (b**2 - (4 * a * c)) < 0: >         return None, None # Can't solve >     x1 = -b - (sqrt(b**2 - (4 * a * c)) / (2 * a)) >    

Re: Which sparse matrix package?

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 10:49 AM, wrote: > On Fri, 19 Dec 2008 08:33:28 +1000 > "James Mills" wrote: > >> > The dict that I tried out is of the type: >> > >> > {(1,2,3): "2323", (1,2,545): "2324234", ... } >> > >> > It is too slow for my application when it grows. One slicing >> > operation with

Re: Factoring Polynomials

2008-12-18 Thread James Mills
UPDATE: jmi...@atomant:~/tmp$ cat polycalc.py #!/usr/bin/env python from math import sqrt def f(a, b, c): if (b**2 - (4 * a * c)) < 0: return None, None # Can't solve x1 = -b - (sqrt(b**2 - (4 * a * c)) / (2 * a)) x2 = -b + (sqrt(b**2 - (4 * a * c)) / (2 * a)) return x1,

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Neal Becker
Steven D'Aprano wrote: > BTW Neal, your posts aren't word wrapped. When I read your posts, I get > each paragraph as one extremely LONG line scrolling way out to the side. > That's against the Internet standards for both email and Usenet, so could > you please configure your client to word-wrap at

Re: Factoring Polynomials

2008-12-18 Thread James Mills
Hi Collin, Here you go: jmi...@atomant:~/tmp$ cat polycalc.py #!/usr/bin/env python from math import sqrt def f(a, b, c): if (b**2 - (4 * a * c)) < 0: return None, None # Can't solve x = (-1 * b) + (((b**2 - (4 * a * c)) ** 0.5) / (2 * a)) return (-1 * x), x print "Polynomi

Re: Which sparse matrix package?

2008-12-18 Thread mmanns
On Thu, 18 Dec 2008 18:04:19 -0600 Robert Kern wrote: > Martin Manns wrote: > > > Should I use another type of matrix in scipy.sparse? If yes which? > > If you have a benchmark, you might just want to try all of them. > Should be just a matter of a small script. Block Sparse Row > (bsr_matrix)

Re: subprocess.Popen inheriting

2008-12-18 Thread Gabriel Genellina
En Thu, 18 Dec 2008 19:46:45 -0200, Aaron Brady escribió: On Dec 17, 7:16 pm, "Gabriel Genellina" wrote: En Wed, 17 Dec 2008 22:46:32 -0200, Aaron Brady   escribió: > On Dec 17, 5:05 pm, "Gabriel Genellina" > wrote: >> En Wed, 17 Dec 2008 12:21:38 -0200, Jeremy Sanders   >> escribió:

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Steven D'Aprano
On Thu, 18 Dec 2008 22:11:27 -0200, Gabriel Genellina wrote: > En Thu, 18 Dec 2008 14:05:32 -0200, Mikael Olofsson > escribió: ... >> If I ever wanted __str__ and __repr__ to return the same thing, I would >> make them equal: >> >> def __str__(self): >> return 'whatever you want' >> __repr__

Re: Factoring Polynomials

2008-12-18 Thread Steven D'Aprano
On Thu, 18 Dec 2008 11:37:35 -0800, collin.day.0 wrote: > I am trying to write a simple application to factor polynomials. I wrote > (simple) raw_input lines to collect the a, b, and c values from the > user, but I dont know how to implement the quadratic equation > > x = (-b +or- (b^2 - 4ac)^1/2

Re: Factoring Polynomials

2008-12-18 Thread Benjamin Kaplan
On Thu, Dec 18, 2008 at 7:59 PM, Collin D wrote: > On Dec 18, 4:41 pm, "James Mills" > wrote: > > On Fri, Dec 19, 2008 at 10:11 AM, Gabriel Genellina > > > > wrote: > > > En Thu, 18 Dec 2008 17:37:35 -0200, escribió: > > > > >> I am trying to write a simple application to factor polynomials. I

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Steven D'Aprano
On Thu, 18 Dec 2008 10:49:27 -0500, Neal Becker wrote: > So if I want to overload something in my custom class, so that I get a > nice string whether it's printed directly, or as part of a container, > what is the recommendation? Overload both __str__ and __repr__? Either or both or neither, wha

Re: Factoring Polynomials

2008-12-18 Thread Collin D
On Dec 18, 4:41 pm, "James Mills" wrote: > On Fri, Dec 19, 2008 at 10:11 AM, Gabriel Genellina > > wrote: > > En Thu, 18 Dec 2008 17:37:35 -0200, escribió: > > >> I am trying to write a simple application to factor polynomials. I > >> wrote (simple) raw_input lines to collect the a, b, and c val

Re: Which sparse matrix package?

2008-12-18 Thread mmanns
On Fri, 19 Dec 2008 08:33:28 +1000 "James Mills" wrote: > > The dict that I tried out is of the type: > > > > {(1,2,3): "2323", (1,2,545): "2324234", ... } > > > > It is too slow for my application when it grows. One slicing > > operation with list comprehensions takes about 1/2 s on my computer

Re: Factoring Polynomials

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 10:11 AM, Gabriel Genellina wrote: > En Thu, 18 Dec 2008 17:37:35 -0200, escribió: > >> I am trying to write a simple application to factor polynomials. I >> wrote (simple) raw_input lines to collect the a, b, and c values from >> the user, but I dont know how to implement

Re: Factoring Polynomials

2008-12-18 Thread Gabriel Genellina
En Thu, 18 Dec 2008 17:37:35 -0200, escribió: I am trying to write a simple application to factor polynomials. I wrote (simple) raw_input lines to collect the a, b, and c values from the user, but I dont know how to implement the quadratic equation x = (-b +or- (b^2 - 4ac)^1/2) / 2a into pyth

Re: subprocess.Popen inheriting

2008-12-18 Thread Gabriel Genellina
En Thu, 18 Dec 2008 08:35:58 -0200, Aaron Brady escribió: On Dec 17, 7:16 pm, "Gabriel Genellina" wrote: En Wed, 17 Dec 2008 22:46:32 -0200, Aaron Brady   escribió: > On Dec 17, 5:05 pm, "Gabriel Genellina" > wrote: >> En Wed, 17 Dec 2008 12:21:38 -0200, Jeremy Sanders   >> escribió: >

Re: importing csv file into sqlite

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 10:11 AM, Gabriel Genellina wrote: > But your code does *exactly* that, it reads the whole file in memory: > >> def mkBuffer(fd): >> buffer = StringIO() >> buffer.write(fd.read()) >> ... > > That mkBuffer function has no useful purpose IMHO, just remove it. It was a mis

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Gabriel Genellina
En Thu, 18 Dec 2008 14:05:32 -0200, Mikael Olofsson escribió: Diez B. Roggisch wrote: Yep. And it's easy enough if you don't care about them being different.. def __repr__(self): return str(self) If I ever wanted __str__ and __repr__ to return the same thing, I would make them equal:

Re: [Help] The pywinauto Can't select the MDI's menu using the MenuItems() which return [].

2008-12-18 Thread Gabriel Genellina
En Thu, 18 Dec 2008 11:28:54 -0200, Simon Brunning escribió: 2008/12/18 为爱而生 : This problem also use the following discription: How to use pywinauto to open WORD and select its Menu. I can't do that and have no idea why! Looking forward your help,Thanks! Word can be automated with COM. My go

Re: importing csv file into sqlite

2008-12-18 Thread Gabriel Genellina
En Thu, 18 Dec 2008 04:17:47 -0200, James Mills escribió: How big ? When size is important in data processing, you should _never_ try to load it all up at once. Use filters... But your code does *exactly* that, it reads the whole file in memory: def mkBuffer(fd): buffer = StringIO() buf

Re: Which sparse matrix package?

2008-12-18 Thread Robert Kern
Martin Manns wrote: Should I use another type of matrix in scipy.sparse? If yes which? If you have a benchmark, you might just want to try all of them. Should be just a matter of a small script. Block Sparse Row (bsr_matrix) might be the most appropriate in terms of data structure, but it ap

Re: Which sparse matrix package?

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 8:52 AM, Robert Kern wrote: > pyspread *is* the spreadsheet application he is writing. Oh :) My bad :) --JamesMills -- http://mail.python.org/mailman/listinfo/python-list

Re: Which sparse matrix package?

2008-12-18 Thread eric
On Dec 18, 11:52 pm, MRAB wrote: > James Mills wrote: > > On Fri, Dec 19, 2008 at 8:18 AM, Martin Manns wrote: > >> Hi: > > > Hi, > > >> I am writing a spreadsheet application in Python > > > What's wrong with pyspread ? > > > [ ... snip ... ] > > >> The dict that I tried out is of the type: > >

Re: how to dock another application under Linux ?

2008-12-18 Thread David Boddie
On Thursday 18 December 2008 20:09, Stef Mientki wrote: > Under windows it's fairly easy to capture an application > and dock in to your own wxPython application, > something like this: > - start the external application from within wxPython > - give the caption of the application a special name >

Re: psycopg2 and large queries

2008-12-18 Thread Paul Boddie
On 18 Des, 22:28, Laszlo Nagy wrote: > > I'm just looking for something that can replace psycopg2, because of the > bug mentioned in my original post. Here are my options: > > - psycopg1: development stalled > - psycopg2: memory bug and/or not db api compilant (see my original post) If you want,

Re: setup.py installs modules to a wrong place

2008-12-18 Thread Michal Ludvig
Ping! Does anyone know what the problem could be? The bug reported provided some more information recently... The modules have been installed to /usr/lib/python2.5/site-packages as show below. Apparently on his system /usr/lib/python2.5 is a symlink to /System/Library/Frameworks/Python.framewor

Re: Python lex settings

2008-12-18 Thread Robert Kern
Sergey Shepelev wrote: Hello. I'm trying to make almost-Python source to Erlang source translation tool. Are there ready ply.lex settings for parsing python source? Yes! Andrew Dalke has implemented a PLY grammar for Python for experimenting with almost-Python languages. http://www.dalke

Python lex settings

2008-12-18 Thread Sergey Shepelev
Hello. I'm trying to make almost-Python source to Erlang source translation tool. Are there ready ply.lex settings for parsing python source? -- http://mail.python.org/mailman/listinfo/python-list

Re: psycopg2 and large queries

2008-12-18 Thread M.-A. Lemburg
On 2008-12-18 22:28, Laszlo Nagy wrote: > >> Well, there are plenty of PostgreSQL modules around these days, and >> even if pyPgSQL isn't suitable, I'm sure that there must be one which >> can be made to work on Windows and to support server-side cursors. See >> here for more: >> >> http://wiki.py

Re: Which sparse matrix package?

2008-12-18 Thread MRAB
James Mills wrote: On Fri, Dec 19, 2008 at 8:18 AM, Martin Manns wrote: Hi: Hi, I am writing a spreadsheet application in Python What's wrong with pyspread ? [ ... snip ... ] The dict that I tried out is of the type: {(1,2,3): "2323", (1,2,545): "2324234", ... } It is too slow for my

Re: Which sparse matrix package?

2008-12-18 Thread Robert Kern
James Mills wrote: On Fri, Dec 19, 2008 at 8:18 AM, Martin Manns wrote: Hi: Hi, I am writing a spreadsheet application in Python What's wrong with pyspread ? pyspread *is* the spreadsheet application he is writing. -- Robert Kern "I have come to believe that the whole world is an enig

Re: Factoring Polynomials

2008-12-18 Thread Collin D
On Dec 18, 1:09 pm, Mark Dickinson wrote: > On Dec 18, 8:47 pm, Scott David Daniels wrote: > > >      else: # a single result (discriminant is zero) > >          return (-b / (2 * a),) > > Maybe make that (-b / (2. * a)) to avoid getting funny results > when a and b are integers.  (Or do a from _

Re: Factoring Polynomials

2008-12-18 Thread eric
On Dec 18, 9:40 pm, "J. Cliff Dyer" wrote: > On Thu, 2008-12-18 at 11:52 -0800, eric wrote: > > On Dec 18, 8:37 pm, collin.da...@gmail.com wrote: > > > I am trying to write a simple application to factor polynomials. I > > > wrote (simple) raw_input lines to collect the a, b, and c values from > >

Re: Which sparse matrix package?

2008-12-18 Thread James Mills
On Fri, Dec 19, 2008 at 8:18 AM, Martin Manns wrote: > Hi: Hi, > I am writing a spreadsheet application in Python What's wrong with pyspread ? [ ... snip ... ] > The dict that I tried out is of the type: > > {(1,2,3): "2323", (1,2,545): "2324234", ... } > > It is too slow for my application w

Which sparse matrix package?

2008-12-18 Thread Martin Manns
Hi: I am writing a spreadsheet application in Python http://pyspread.sf.net which currently uses numpy.array for: + storing object references (each array element corresponds to one grid cell) + slicing (read and write) + mapping from/to smaller numpy.array + searching and replacing + growing

Re: psycopg2 and large queries

2008-12-18 Thread D'Arcy J.M. Cain
On Thu, 18 Dec 2008 22:28:23 +0100 Laszlo Nagy wrote: > - PyGresSQL: apparently, it does not support fetching one row, only > fetching all rows (see: > http://www.pygresql.org/pg.html#getresult-get-query-values-as-list-of-tuples), > > so this is not an option. (Yes, it also has a db api compil

Re: subprocess.Popen inheriting

2008-12-18 Thread Aaron Brady
On Dec 17, 7:16 pm, "Gabriel Genellina" wrote: > En Wed, 17 Dec 2008 22:46:32 -0200, Aaron Brady   > escribió: > > > > > On Dec 17, 5:05 pm, "Gabriel Genellina" > > wrote: > >> En Wed, 17 Dec 2008 12:21:38 -0200, Jeremy Sanders   > >> escribió: > > >> > It would be nice if Python created pipes

Re: Tkinter unbinding

2008-12-18 Thread r
On Dec 18, 1:48 pm, Roger wrote: > On Dec 18, 12:49 pm, r wrote: > > > Maybe someone will chime in with an answer, sorry i could not help. > > ponder this, i must... > > Regardless, thanks for your help! I truly appreciate it. > > Roger. 'no problema mi amigo!'.to_english(no problem my friend!)

Re: C API and memory allocation

2008-12-18 Thread Aaron Brady
On Dec 18, 7:54 am, Stefan Behnel wrote: > Aaron Brady wrote: > > I see.  Do I read correctly that 's' is only useful when the > > argument's position is known? > > I assume you meant "length". No, position in the argument list. Otherwise you can't change its reference count; in which case, a po

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Steve Holden
Neal Becker wrote: > Mel wrote: > >> Neal Becker wrote: >> >>> Tino Wildenhain wrote: >>> Neal Becker wrote: > Reading some FAQ, I see that __str__ is "meant for human eyes". > > But it seems that: > class X(object): > def __str__(self): > return "str"

Re: psycopg2 and large queries

2008-12-18 Thread Laszlo Nagy
Well, there are plenty of PostgreSQL modules around these days, and even if pyPgSQL isn't suitable, I'm sure that there must be one which can be made to work on Windows and to support server-side cursors. See here for more: http://wiki.python.org/moin/PostgreSQL I'm just looking for somethin

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Scott David Daniels
J. Cliff Dyer wrote: ... how an object prints itself is up to that object and that object alone If I wanted to implement a list-like class that doesn't show it's elements at > all when printed, but instead shows its length, I am free to do so. For example: hl = HiddenList(1,2,3) hl hl

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Robert Kern
Mikael Olofsson wrote: Diez B. Roggisch wrote: Yep. And it's easy enough if you don't care about them being different.. def __repr__(self): return str(self) If I ever wanted __str__ and __repr__ to return the same thing, I would make them equal: def __str__(self): return 'whatever

Re: psycopg2 and large queries

2008-12-18 Thread Paul Boddie
On 18 Des, 19:09, Steve Holden wrote: > > Hmm, pypgsql doesn't provide a 2.5 Windows installer. I take it you > aren't a Windows user ... ? Well, there are plenty of PostgreSQL modules around these days, and even if pyPgSQL isn't suitable, I'm sure that there must be one which can be made to work

Re: Factoring Polynomials

2008-12-18 Thread Mark Dickinson
On Dec 18, 8:47 pm, Scott David Daniels wrote: >      else: # a single result (discriminant is zero) >          return (-b / (2 * a),) Maybe make that (-b / (2. * a)) to avoid getting funny results when a and b are integers. (Or do a from __future__ import division, or use Python 3.0, or )

Re: confused about __str__ vs. __repr__

2008-12-18 Thread J. Cliff Dyer
On Thu, 2008-12-18 at 13:35 -0500, Neal Becker wrote: > Mel wrote: > > > Neal Becker wrote: > > > >> Tino Wildenhain wrote: > >> > >>> Neal Becker wrote: > Reading some FAQ, I see that __str__ is "meant for human eyes". > > But it seems that: > class X(object): > d

Re: Factoring Polynomials

2008-12-18 Thread Scott David Daniels
eric wrote: On Dec 18, 8:37 pm, collin.da...@gmail.com wrote: ... I dont know how to implement the quadratic equation ... with numpy: from numpy import * s=[1,-1] x = -b+s*sqrt( b**2-4*a*c )/(2*a) Numpy is pretty heavyweight for this. For built in modules you have a few choices: For real

Re: Factoring Polynomials

2008-12-18 Thread J. Cliff Dyer
On Thu, 2008-12-18 at 11:52 -0800, eric wrote: > On Dec 18, 8:37 pm, collin.da...@gmail.com wrote: > > I am trying to write a simple application to factor polynomials. I > > wrote (simple) raw_input lines to collect the a, b, and c values from > > the user, but I dont know how to implement the qua

Re: IDLE cursor color

2008-12-18 Thread r
also try the python forum, great place for beginners... http://www.python-forum.org/pythonforum/index.php -- http://mail.python.org/mailman/listinfo/python-list

Re: Factoring Polynomials

2008-12-18 Thread Collin D
On Dec 18, 11:52 am, eric wrote: > On Dec 18, 8:37 pm, collin.da...@gmail.com wrote: > > > I am trying to write a simple application to factor polynomials. I > > wrote (simple) raw_input lines to collect the a, b, and c values from > > the user, but I dont know how to implement the quadratic equat

Re: IDLE cursor color

2008-12-18 Thread Vicent Giner
On 18 dic, 20:52, r wrote: > in IDLE go to: > Options -> Configure IDLE -> Highlighting... > > 1.) in the box click the word "cursor" > 2.) press the button that says "Choose Color for" > 3.) Pick a color and save the changes > > viola! you did it! :) Thank you! I don't understand... I have trie

Re: Factoring Polynomials

2008-12-18 Thread eric
On Dec 18, 8:37 pm, collin.da...@gmail.com wrote: > I am trying to write a simple application to factor polynomials. I > wrote (simple) raw_input lines to collect the a, b, and c values from > the user, but I dont know how to implement the quadratic equation > > x = (-b +or- (b^2 - 4ac)^1/2) / 2a >

Re: IDLE cursor color

2008-12-18 Thread r
in IDLE go to: Options -> Configure IDLE -> Highlighting... 1.) in the box click the word "cursor" 2.) press the button that says "Choose Color for" 3.) Pick a color and save the changes viola! you did it! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter unbinding

2008-12-18 Thread Roger
On Dec 18, 12:49 pm, r wrote: > Maybe someone will chime in with an answer, sorry i could not help. > ponder this, i must... Regardless, thanks for your help! I truly appreciate it. Roger. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter unbinding

2008-12-18 Thread Roger
On Dec 18, 12:49 pm, r wrote: > Maybe someone will chime in with an answer, sorry i could not help. > ponder this, i must... Regardless, thanks for your help! I truly appreciate it. Roger. -- http://mail.python.org/mailman/listinfo/python-list

Factoring Polynomials

2008-12-18 Thread collin . day . 0
I am trying to write a simple application to factor polynomials. I wrote (simple) raw_input lines to collect the a, b, and c values from the user, but I dont know how to implement the quadratic equation x = (-b +or- (b^2 - 4ac)^1/2) / 2a into python. Any ideas? -- http://mail.python.org/mailman/l

Re: Location HTTP Header

2008-12-18 Thread Mohamed Yousef
use LiveHTTPHeaders with firefox and show us browser-server interaction -- http://mail.python.org/mailman/listinfo/python-list

IDLE cursor color

2008-12-18 Thread Vicent Giner
I am working with IDLE, version 1.2.2 I've changed the colors theme using the "Options > Configure IDLE..." menu option. I've chosen a black background for all the items, so now my work area is black, and everything is OK, except for the fact that I can't see where the cursor is located, I mean,

Re: Tkinter unbinding

2008-12-18 Thread Roger
On Dec 18, 12:49 pm, r wrote: > Maybe someone will chime in with an answer, sorry i could not help. > ponder this, i must... Regardless, thanks for your help! I truly appreciate it. Roger. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter unbinding

2008-12-18 Thread Roger
On Dec 18, 12:49 pm, r wrote: > Maybe someone will chime in with an answer, sorry i could not help. > ponder this, i must... Regardless, thanks for your help! I truly appreciate it. Roger. -- http://mail.python.org/mailman/listinfo/python-list

how to dock another application under Linux ?

2008-12-18 Thread Stef Mientki
hello, Under windows it's fairly easy to capture an application and dock in to your own wxPython application, something like this: - start the external application from within wxPython - give the caption of the application a special name - find de windows handler of the applications mainform - te

Re: Is this pythonic?

2008-12-18 Thread Jason Scheirer
On Dec 18, 8:45 am, prueba...@latinmail.com wrote: > On Dec 18, 11:08 am, ipyt...@gmail.com wrote: > > > x.validate_output(x.find_text(x.match_filename > > (x.determine_filename_pattern(datetime.datetime.now() > > > Is it even good programming form? > > Lisp and Scheme programmers love that sty

Adjusting filename and line number

2008-12-18 Thread banshee . welton
Hello, I'm working with some embedded python and would like to be able to adjust the reported filename and line number of some embedded user- written code so that errors returned coincide with things the user might actually be familiar with. In perl I could do this by adjusting the filename a

Re: confused about __str__ vs. __repr__

2008-12-18 Thread Neal Becker
Mel wrote: > Neal Becker wrote: > >> Tino Wildenhain wrote: >> >>> Neal Becker wrote: Reading some FAQ, I see that __str__ is "meant for human eyes". But it seems that: class X(object): def __str__(self): return "str" def __repr__(self):

Re: psycopg2 and large queries

2008-12-18 Thread Steve Holden
Paul Boddie wrote: [...]> > You really don't want to be traversing large data sets using fetchone, > anyway. My approach (using pyPgSQL) involves fetchmany and then > looping over each batch of results, if I really have to process the > data in Python; most of the time I can do the processing in t

Re: Tkinter unbinding

2008-12-18 Thread r
Maybe someone will chime in with an answer, sorry i could not help. ponder this, i must... -- http://mail.python.org/mailman/listinfo/python-list

Re: psycopg2 and large queries

2008-12-18 Thread Paul Boddie
On 18 Des, 16:34, Laszlo Nagy wrote: > psycopg2 is said to be db api 2.0 compilant, but apparent it is buggy. > By default, when I create a cursor with > > cur = conn.cursor() > > then it creates a cursor that will fetch all rows into memory, even if > you call cur.fetchone() on it. (I tested it,

  1   2   >