Re: Multiplying all the values in a dictionary

2006-03-23 Thread Adam DePrince
Yes, I cede that explicit indexing is faster by quite a bit. There is a somewhat philosophical decision for why I avoided that. I prefer to try to present python with as big of a picture of what I want as possiable. update tells python what I want to do, whereas the for-loop describes how to. I

Re: Question about raw string and regex

2006-03-23 Thread jlowery
Gotta love the attitude of people on .lang newsgroups The unraw '\t' might work, but all the example in the tutorial use raw strings, so why not be consistent in the example scripts? 1.5.2? Aren't we at 2.4.2 now? So the regs documentation was pulled, yet the source code shipped with the

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Erik Max Francis
Jorge Godoy wrote: > [EMAIL PROTECTED] writes: > >> heh.. It works except I am using psycopg.Binary(somebinarystructure), >> and I am not really doing it by hand to just add the extra %, and >> psycopg.Binary doesn't do it. I'd imagine it's a bug with psycopg >> package. Any quick way to project

Re: New development windows, IronPython or PythonWin

2006-03-23 Thread Casey Hawthorne
Butternut squash <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: > >> IronPython is currently nowhere near production quality. I would not >> recommend it. > >But it's so cool. It's cool to have bugs? That really BUGS ME! -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-

Re: __slots__

2006-03-23 Thread David Isaac
"Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > If you want to restrict attribute asignment, you should use the > __setattr__ special method, see: > http://docs.python.org/ref/attribute-access.html That "should" is what I am asking about. If I understand, in the simplest case, you want me to say so

Re: encoding problems (é and è)

2006-03-23 Thread John Machin
On 24/03/2006 2:19 PM, Jean-Paul Calderone wrote: > On Fri, 24 Mar 2006 09:33:19 +1100, John Machin <[EMAIL PROTECTED]> > wrote: > >> On 24/03/2006 8:36 AM, Peter Otten wrote: >> >>> John Machin wrote: >>> You can replace ALL of this upshifting and accent removal in one blow by us

Re: Question about raw string and regex

2006-03-23 Thread John Machin
On 24/03/2006 2:57 PM, [EMAIL PROTECTED] wrote: > Gotta love the attitude of people on .lang newsgroups > > > The unraw '\t' might work, but all the example in the tutorial use raw > strings, so why not be consistent in the example scripts? classfix.py is not an *example* script. It is (was

Re: Multiplying all the values in a dictionary

2006-03-23 Thread Adam DePrince
Wait! It occured to me. Why are we touching the key at all. This is a dictionary with mutable values. [EMAIL PROTECTED] ~]$ python2.4 -mtimeit -s 'd = {(100,500):[5,5], (100,501):[6,6], (100,502):[7,7]}; x = dict(d)' 'for i in x.values(): i[:]=[j*1 for j in i]' 10 loops, best of 3: 2.79 us

Re: Multiplying all the values in a dictionary

2006-03-23 Thread Adam DePrince
Excuse me, I mean python2.4 -mtimeit -s 'from numarray import array; d = {(100,500):[5,5], (100,501):[6,6], (100,502):[7,7]}; x = dict(d);' 'for i in x.values(): i[0]*=1;i[1]*=1' 100 loops, best of 3: 1.72 usec per loop i[0]*=1, not j[0]*=1 ... -- http://mail.python.org/mailman/listinfo/p

Re: New development windows, IronPython or PythonWin

2006-03-23 Thread Jorge Godoy
Casey Hawthorne <[EMAIL PROTECTED]> writes: > Butternut squash <[EMAIL PROTECTED]> wrote: > >>[EMAIL PROTECTED] wrote: >> >>> IronPython is currently nowhere near production quality. I would not >>> recommend it. >> >>But it's so cool. > > It's cool to have bugs? > > That really BUGS ME! You're c

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Jorge Godoy
Erik Max Francis <[EMAIL PROTECTED]> writes: > Raw strings don't have anything to do with format specifiers. I know. I'm just trying to see if there might be some magic going on with his driver... -- Jorge Godoy <[EMAIL PROTECTED]> "Quidquid latine dictum sit, altum sonatur." - Qualquer

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Erik Max Francis
Jorge Godoy wrote: > I know. I'm just trying to see if there might be some magic going on with his > driver... Since raw strings have no effect on format specifiers, that won't tell you anything. >>> r'%' == '%' True His problem is that cursor.execute does format expansion with %, so a sin

Re: RELEASED Python 2.4.3, release candidate 1

2006-03-23 Thread Paddy
I just Googled and found the Python-Dev thread 'About "Coverity Study Ranks LAMP Code Quality" '. I was heartened by the type of issues raised in the discussion - it leaves me content with whats 'under-the-hood' in Python. You maintainers don't seem to bang your own drum, which is a good thing, bu

Re: COM callbacks in Python

2006-03-23 Thread Roger Upole
"Dan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I need to register for a COM callback under Windows. I am using an ADO > recordset interface like this: > > import win32com.client > import time > connect = win32com.client.Dispatch("ADODB.Connection") > recordset = win32com.clien

overlapping sets

2006-03-23 Thread kpp9c
I have a question... and ... whew ... i am gonna be honest, i haven't the slightest clue how to even start ... i am not sure if i used up all my good will here or can take a mulligan.. i love to try to at least post some lame broken code of my own at first... but like i said, not being a math perso

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-23 Thread Dirk Thierbach
Dinko Tenev <[EMAIL PROTECTED]> wrote: >> > I don't see immediately how exactly this is going to work. Unless I'm >> > very much mistaken, a FSA in the classical sense will accept or reject >> > only after the whole sequence has been consumed, and this spells >> > exponential times. >> Exponentia

Re: Remove integer from float number

2006-03-23 Thread kpp9c
okay... out of curiousity... how would you then seperate the interger value from the fractional part do something to one side and then put it back together... like if you had 8.01 and you want to add to the '8' part in one way (ordinary decimal) and add to the .01 part modulo something .. like say

Re: RELEASED Python 2.4.3, release candidate 1

2006-03-23 Thread Fredrik Lundh
Delaney, Timothy wrote: > However, there were definitely things found that were real bugs, and > subsequently fixed. absolutely. but a significant chunk of those bugs were in the "will leak references or access null pointers under extreme low-memory conditions, but it's not very likely that you

Re: overlapping sets

2006-03-23 Thread Adam DePrince
On Thu, 2006-03-23 at 22:55 -0800, kpp9c wrote: > I have a question... and ... whew ... i am gonna be honest, i haven't > the slightest clue how to even start ... i am not sure if i used up all > my good will here or can take a mulligan.. i love to try to at least > post some lame broken code of my

Re: Terminating a subprocess '.exe'

2006-03-23 Thread Fredrik Lundh
"Ernesto" wrote: > I launch a Windows executable and wish to close it from Python. The > code is below. Normally, my program waits for rib.exe to finish, but > I'd like to be able to close it from python if possible. (I suppose if > I was going to do this, I wouldn't use .wait() ) Any ideas ?

Re: Strings and % sign fails - Help Please

2006-03-23 Thread Christoph Zwerschke
Erik Max Francis wrote: > His problem is that cursor.execute does format expansion with %, so a > single % is not legal. Yes, I think psycopg uses paramstyle='pyformat', i.e. it expands parameters in your sql in the usual Python way where % has a special meaning. If you really mean the % sign o

Capturing gdb output in pyhton script using gdb -batch -x arguments

2006-03-23 Thread Surendra
Hi Friends, I am in need of gudance for getting ouput from the gdb objfile -batch -x gdb batch_command_file But I am not able to see messages on display. So kindly guide me if u have any experience about it. batch_command_file: list *0x840230fd echo bla bla... -- http://mail.python.org/mai

s = raw_input ("hello whats your name? ")

2006-03-23 Thread cm012b5105
Hi there i am hoping some one could help me out with a small problem i am in the process of learning python.I am trying to write an interactive programme, This is a short example. if s = raw_input ("hello what’s your name? ") if s=='carmel': Print "Ahh the boss’s wife" What i would like to

Re: Question about raw string and regex

2006-03-23 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > 1.5.2? Aren't we at 2.4.2 now? So the regs documentation was pulled, > yet the source code shipped with the installer still uses it? How are > people suppose to make heads or tails of a language when it ships with > deprecated, undocumented code? $ more classfix.py #

<    1   2   3