Re: problem with split

2006-10-07 Thread [EMAIL PROTECTED]
I am not sure if I am having trouble with the test program or the routine.. (I had the brackets in the wrong place on the other) IDLE 1.1.3 No Subprocess >>> ['1', 'String pad'] >>> I get this but I have at least three lines and the v = [] v = csoundroutines.csdInstrumentList('ba

Re: humble coin head or tail game script I wrote

2006-10-07 Thread Steve Holden
Camellia wrote: > Oh I get it and ashamed, thank you for explaining it to me:) > > so I sould: > ini_guess=random.randrange(2) > > for item in list: > if item=='h': > ... > if item ==t': > ... > Welcome to programming. You have learned, as many thousands have learned

Re: Subclassing built-in classes

2006-10-07 Thread Gabriel Genellina
At Friday 6/10/2006 06:58, Maric Michaud wrote: As the first post said "...couldn't python (in theory)...", I was discussing if it would be possible for python (in some future version) to manage the literals so that they use the constructors in the __builtin__ module, I didn't say it works actua

Re: dictionary containing a list

2006-10-07 Thread Steve Holden
John Machin wrote: > Ben wrote: > >>Hello... >> >>I have set up a dictionary into whose values I am putting a list. I >>loop around and around filling my list each time with new values, then >>dumping this list into the dictionary. Or so I thought... >> >>It would appear that what I am dumping int

Re: How to execute a python script in .NET application

2006-10-07 Thread Steve Holden
Chandra wrote: > Hi, > > Is there a way to execute a python script(file) in ASP.NET application > (programmatically)?? > Probably use IronPython, I should think. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: h

Re: Subclassing built-in classes

2006-10-07 Thread hanumizzle
On 10/7/06, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > At Friday 6/10/2006 06:58, Maric Michaud wrote: > > >As the first post said "...couldn't python (in theory)...", I was discussing > >if it would be possible for python (in some future version) to manage the > >literals so that they use the

Re: Python to use a non open source bug tracker?

2006-10-07 Thread Giovanni Bajo
[EMAIL PROTECTED] wrote: > Giovanni> Are bug-tracker configuration issues so critical that > having Giovanni> to wait 48-72hrs to have them fixed is > absolutely unacceptable Giovanni> for Python development? > > Yes, I think that would put a crimp in things. The downtimes we see > fo

Re: n-body problem at shootout.alioth.debian.org

2006-10-07 Thread Giovanni Bajo
Peter Maas wrote: > I have noticed that in the language shootout at > shootout.alioth.debian.org the Python program for the n-body problem > is about 50% slower than the Perl program. This is an unusual big > difference. I tried to make the Python program faster but without > success. Has anybody

Re: humble coin head or tail game script I wrote

2006-10-07 Thread Ant
> # Get a list which contains 10 values from the user > # let them predict Head Or Tail in ten times coin thrown > # and then prdict the list by a fixed rule > > > list = [] > > print 'Predict Head or Tail in ten times coin thrown\nJust input \'h\' > or \'t\' please\n' > > count = 0 > while True:

Re: dictionary containing a list

2006-10-07 Thread Fredrik Lundh
Steve Holden wrote: > One of the fascinating things about c.l.py is that sometimes a questin > will be posted that makes almost no sense to me, and somebody else will > casually read the OP's mind, home in on the issue and provide a useful > and relevant answer. if the assertions made by some

Re: Can't get around "IndexError: list index out of range"

2006-10-07 Thread Gabriel Genellina
At Saturday 7/10/2006 02:15, MonkeeSage wrote: On Oct 6, 8:23 pm, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > if 2 in [1,2,3]: print "Use the same (in) operator" > elif 'E' in ('E','r','i','k'): print "Works for any sequence" > elif 'o' in 'hello': print "Even strings" This isn't really anal

Re: Dumping the state of a deadlocked process

2006-10-07 Thread Hendrik van Rooyen
<[EMAIL PROTECTED]> wrote: > Hi all > > I'm currently having some issues with a process getting deadlocked. The > problem is that the only way I can seem to find information about where > it deadlocks is by making a wild guess, insert a pdb.set_trace() before > this point, and then step until it l

Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. AndySingleton

2006-10-07 Thread Hendrik van Rooyen
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: 8<--- > ... - I don't wanna get > into the details of my underwear :P > > Diez Why not? - what are you hiding? - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionary containing a list

2006-10-07 Thread John Machin
Steve Holden wrote: > John Machin wrote: > > Ben wrote: > > > >>Hello... > >> > >>I have set up a dictionary into whose values I am putting a list. I > >>loop around and around filling my list each time with new values, then > >>dumping this list into the dictionary. Or so I thought... > >> > >>It

Re: humble coin head or tail game script I wrote

2006-10-07 Thread Camellia
Steve Holden thank you for your kind words, they pumped me up:) I don't really know much about TDD however I googled it and found this: http://www.agiledata.org/essays/tdd.html Which is obvious too complicated. However I'll read through it anyway. Thank you for your advice:) Ant thank you for poin

Re: Dumping the state of a deadlocked process

2006-10-07 Thread andre . naess
MrJean1 wrote: > Did you try using the signal module? If not, a basic example is here > which may need to be > extended. I looks useful. I gave it a try, and the only weakness it has is that when my process locks, it locks so badly that it doesn't respon

Re: humble coin head or tail game script I wrote

2006-10-07 Thread Camellia
OK so this is the result after I taking everything I'm teached in this thread: print 'Predict Head or Tail in ten times coin thrown\nJust input \'h\' or \'t\' please\n' count = 0 user_input = [] while len(user_input) < 10: print '\nNo.', len(user_input)+1, ', h or t?' pre_user = raw_inp

Re: n-body problem at shootout.alioth.debian.org

2006-10-07 Thread bearophileHUGS
Paddy: > You might also put the outer loop calling function advance so many > times, into the advance function: Remember that the autors of the Shootout refuse some changes to the code (like this one), to allow a fair comparison. The rules are strict. I have improved the Psyco version: http://sho

Re: problem with split

2006-10-07 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I think I am very close the return line is tripping me up. (this is > the first list that I have tried to program in python) > > return (s.group[1], s.group[2]) > > Traceback (most recent call last): > File "C:\Python24\Lib\site-packages\boa-constructor\test of > sna

Re: extract certain values from file with re

2006-10-07 Thread Fabian Braennstroem
Hi to all, thanks a lot! I am pretty sure your ideas help :-) Greetings! Fabian -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute a python script in .NET application

2006-10-07 Thread Gerard Flanagan
Chandra wrote: > Hi, > > Is there a way to execute a python script(file) in ASP.NET application > (programmatically)?? > > Regards, > Chandra I thought IIS would prevent this, but the following works for me at home (ASP.NET 1.1). A production setup may be a different matter. using System.Diagn

Re: Dumping the state of a deadlocked process

2006-10-07 Thread Ziga Seilnacht
[EMAIL PROTECTED] wrote: > Hi all > > I'm currently having some issues with a process getting deadlocked. The > problem is that the only way I can seem to find information about where > it deadlocks is by making a wild guess, insert a pdb.set_trace() before > this point, and then step until it lock

Re: Python to use a non open source bug tracker?

2006-10-07 Thread Steve Holden
Giovanni Bajo wrote: [...] > > I understand your concerns, but I have to remember you that most bug reports > submitted by users go totally ignored for several years, or, better, forever. > I > do not have a correct statistic for this, but I'm confident that at least 80% > of the RFE or patches f

Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. AndySingleton

2006-10-07 Thread Steve Holden
Hendrik van Rooyen wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > 8<--- > >>... - I don't wanna get >>into the details of my underwear :P >> >>Diez > > > Why not? - what are you hiding? > :) We *especially* don't want to get into the detail

Re: Scientific computing and data visualization.

2006-10-07 Thread Fabian Braennstroem
Hi, * Carl Friedrich Bolz <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> A commonly used data analysis framework is root (http://root.cern.ch). >> It offers a object oriented C++ framework with all kind of things one >> needs for plotting and data visualization. It comes along with PyRoo

Re: n-body problem at shootout.alioth.debian.org

2006-10-07 Thread Peter Maas
[EMAIL PROTECTED] wrote: >> You might also put the outer loop calling function advance so many >> times, into the advance function: > > Remember that the autors of the Shootout refuse some changes to the > code (like this one), to allow a fair comparison. The rules are strict. I'm only aware of t

Re: News on versions modules for Python-2.5?

2006-10-07 Thread John J. Lee
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Méta-MCI wrote: > > And who can confirm that these modules are independent of Python version? > > > > ReportLab > > I can't confirm it's 100% independent, but I have been using reportlab > on Windows and Linux with Python 2.5. If anything in

Re: Names changed to protect the guilty

2006-10-07 Thread Neil Cerutti
On 2006-10-07, MonkeeSage <[EMAIL PROTECTED]> wrote: > > On Oct 6, 8:34 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> And in the original case, I'd agree that "if X.has_key():" is >> quite clear, already yielding a boolian value, and so doesn't >> need to be tested for if it's False. But I wouldn'

Re: Names changed to protect the guilty

2006-10-07 Thread Steven D'Aprano
On Fri, 06 Oct 2006 18:29:34 -0700, John Machin wrote: > > MonkeeSage wrote: >> On Oct 6, 8:02 pm, "MonkeeSage" <[EMAIL PROTECTED]> wrote: >> > it is clearer to you to make the condition explicit ("blah not False"), >> >> "blah not False" -> "blah is False" > > Whichever way your team wants to i

Re: Names changed to protect the guilty

2006-10-07 Thread John Machin
Steven D'Aprano wrote: > On Fri, 06 Oct 2006 18:29:34 -0700, John Machin wrote: > > > > > MonkeeSage wrote: > >> On Oct 6, 8:02 pm, "MonkeeSage" <[EMAIL PROTECTED]> wrote: > >> > it is clearer to you to make the condition explicit ("blah not False"), > >> > >> "blah not False" -> "blah is False" >

Re: error handling in user input: is this natural or just laborious

2006-10-07 Thread Steven D'Aprano
On Fri, 06 Oct 2006 17:19:01 -0700, sam wrote: > gosh, a lot of work to get some input. i must be missing something, > though this is a lot better than what i had before... Welcome to the real world of programming. Writing your algorithms is, generally, the easy part. Handling data input and outp

Re: Filter class

2006-10-07 Thread TheSaint
On 17:02, sabato 30 settembre 2006 TheSaint wrote: > Hello NG, > > Curious to know whether exists a filter class. > I'm doing some rough mail filtering on my own criteria, but I'm very new on > programming and I like to find some clue on passing a config file of rules > which will be regex by Pyt

Kde Taskbar

2006-10-07 Thread DarkBlue
Hello In linux I use kmail as my email client under KDE, if a message comes in the Kontact button in the taskbar changes to blue. How can I have the same behaviour in a python app ? I have a python script which runs nicely under linux now every so often I want to be notified by some event, in thi

Re: Names changed to protect the guilty

2006-10-07 Thread John Roth
Aahz wrote: > The following line of lightly munged code was found in a publicly > available Python library... > > if schema.elements.has_key(key) is False: > > Sorry, just had to vent. > -- > Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ Uh, guys. IMO, the cleares

Re: error handling in user input: is this natural or just laborious

2006-10-07 Thread bruno de chez modulix en face
sam a écrit : (snip) > i'm still in the early stages, and am trying to code something simple > and interactive to get the percentages of the portfolio in the five > different investment categories. i thought i'd get in with the error > handling early so if someone types in something wrong (like a

curses problem reading cursor keys

2006-10-07 Thread Simon Morgan
Hi, I'm having trouble with the following code. The problem is that the value read by getch() when I hit the up or down keys doesn't match curses.KEY_UP or curses.KEY_DOWN respectively. Other keys, such as 'z' in my example code, work fine. I only seem to have this problem when dealing with newly

Re: Names changed to protect the guilty

2006-10-07 Thread John Machin
John Roth wrote: > Aahz wrote: > > The following line of lightly munged code was found in a publicly > > available Python library... > > > > if schema.elements.has_key(key) is False: > > > > Sorry, just had to vent. > > -- > > Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncra

Re: Python to use a non open source bug tracker?

2006-10-07 Thread Robert Hicks
Giovanni Bajo wrote: > Paul Rubin wrote: > > >> You fail to recognize that Python is *already* using a non-free > >> software for bug tracking, as do thousands of other projects. > > > > I don't think that reflects an explicit decision. SF started out as > > free software and the software became

Re: Python to use a non open source bug tracker?

2006-10-07 Thread Robert Hicks
Steve Holden wrote: > Perhaps what I *should* have written was "Sadly *many* people spend too > much time bitching and moaning about those that roll their sleeves up, > and not enough rolling their own sleeves up and pitching in". > > Sniping from the sidelines is far easier than hard work toward

Re: Python to use a non open source bug tracker?

2006-10-07 Thread Robert Hicks
Giovanni Bajo wrote: > You might also be understimating how negative could be the reaction from the > open-source community to such a move. > -- > Giovanni Bajo That is simply rediculous. Step away from the kool-aid. Robert -- http://mail.python.org/mailman/listinfo/python-list

Re: Kde Taskbar

2006-10-07 Thread Diez B. Roggisch
DarkBlue schrieb: > Hello > > In linux I use kmail as my email client under KDE, > if a message comes in the Kontact button in the > taskbar changes to blue. > How can I have the same behaviour in a python app ? > > I have a python script which runs nicely under linux > now every so often I want

Re: building strings from variables

2006-10-07 Thread Gal Diskin
Matthew Warren wrote: > > -Original Message- > > From: > > [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] > > rg] On Behalf Of Gal Diskin > > Sent: 05 October 2006 16:01 > > To: [email protected] > > Subject: building strings from variables > > > > Following a discussion with an assoc

Re: building strings from variables

2006-10-07 Thread Gal Diskin
First of all - thanks for all the replies. (Sorry for my slowness in answering, but I wrote this message from work, just before leaving for the weekend.) I found a couple of posts that might be of interest: Regarding speed I found a similar discussion in this newsgroup with interesting results: ht

Re: Python to use a non open source bug tracker?

2006-10-07 Thread James Graham
Steve Holden wrote: > Giovanni Bajo wrote: > [...] >> >> I understand your concerns, but I have to remember you that most bug >> reports >> submitted by users go totally ignored for several years, or, better, >> forever. I >> do not have a correct statistic for this, but I'm confident that at >>

Re: Names changed to protect the guilty

2006-10-07 Thread Aahz
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: >Aahz wrote: >> In article <[EMAIL PROTECTED]>, >> MonkeeSage <[EMAIL PROTECTED]> wrote: >>>On Oct 6, 6:27 pm, [EMAIL PROTECTED] (Aahz) wrote: The following line of lightly munged code was found in a publicly avai

Re: Kde Taskbar

2006-10-07 Thread David Boddie
On Saturday 07 October 2006 14:59, DarkBlue wrote: > In linux I use kmail as my email client under KDE, > if a message comes in the Kontact button in the > taskbar changes to blue. > How can I have the same behaviour in a python app ? You need to activate the window associated with the applicatio

Re: Kde Taskbar

2006-10-07 Thread DarkBlue
Diez B. Roggisch wrote: > > pykde afaik supports systray-iconified apps. And you could use the > dcop-mechanisms that are available as command line tools as well I > guess, and invoke knotify. > > Hope this gives you some pointers - I'm currently on my mac so I can't > provide an actual example.

Re: Kde Taskbar

2006-10-07 Thread DarkBlue
David Boddie wrote: > On Saturday 07 October 2006 14:59, DarkBlue wrote: > >> In linux I use kmail as my email client under KDE, >> if a message comes in the Kontact button in the >> taskbar changes to blue. >> How can I have the same behaviour in a python app ? > > You need to activate the wind

Help with first script please. files, directories, autocomplete

2006-10-07 Thread simonharrison
Hello everyone. Hopefully someone can point me in the right direction here. I'm wanting to write a script to open microsoft word and adobe pdf documents . Here is a little background: At the company where I work (an inspection firm) all reports of inspections are saved as word files. A particular

Re: Help with first script please. files, directories, autocomplete

2006-10-07 Thread simonharrison
Forgot to mention I'm using python 2.5 on windows xp. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to use a non open source bug tracker?

2006-10-07 Thread Giovanni Bajo
Steve Holden wrote: >> I understand your concerns, but I have to remember you that most bug >> reports submitted by users go totally ignored for several years, or, >> better, forever. I do not have a correct statistic for this, but I'm >> confident that at least 80% of the RFE or patches filed eve

Re: Multiple calls to logging.config.fileConfig

2006-10-07 Thread Vinay Sajip
logging.config.fileConfig() does not do incremental configuration - it replaces the existing configuration with the configuration in the file passed to fileConfig. While this might not be too useful for your current needs, the present behaviour is by design...fileConfig is meant to choose between o

Re: Can't get around "IndexError: list index out of range"

2006-10-07 Thread MonkeeSage
On Oct 7, 3:27 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > The meaning comes from the most common usage. I wasn't suggesting that the "in" keyword have a different sematic for sequence types. I was just saying that regarding the question whether there is anything similar to "dict.has_key

Re: Is there an alternative to os.walk?

2006-10-07 Thread Bruce
waylan wrote: > Bruce wrote: > > Hi all, > > I have a question about traversing file systems, and could use some > > help. Because of directories with many files in them, os.walk appears > > to be rather slow. I`m thinking there is a potential for speed-up since > > I don`t need os.walk to report f

Re: Names changed to protect the guilty

2006-10-07 Thread Scott David Daniels
John Machin wrote: > ... any function/method whose name begins with "has" or "is" > returns an honest-to-goodness actual bool (or what passed for > one in former times). True for 75% of the builtins: >>> import __builtin__ >>> sorted(nm for nm in dir(__builtin__) if nm.sta

Re: Can't get around "IndexError: list index out of range"

2006-10-07 Thread Fredrik Lundh
MonkeeSage wrote: > True. But valid dictionary keys are exactly d.keys(). The has_key > method is just sugar. for what? are you sure you're using "sugar" as it is usually used when talking about computer languages? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to use a non open source bug tracker?

2006-10-07 Thread Tim Peters
[Giovanni Bajo] > I understand your concerns, but I have to remember you that most bug reports > submitted by users go totally ignored for several years, or, better, forever. > I > do not have a correct statistic for this, Indeed you do not. > but I'm confident that at least 80% of the RFE or pa

Re: Dumping the state of a deadlocked process

2006-10-07 Thread fumanchu
Dennis Lee Bieber wrote: > On 6 Oct 2006 12:59:31 -0700, [EMAIL PROTECTED] declaimed the > following in comp.lang.python: > > > I'm currently having some issues with a process getting deadlocked. The > > problem is that the only way I can seem to find information about where > > it deadlocks is by

Re: error handling in user input: is this natural or just laborious

2006-10-07 Thread sam
a huge amount to think about there. special thanks to james for taking the time to make such detailed responses. the problem is that even though nested loops and the like place a heavy analytical burden on the programmer (i.e. me) as he tries to remember what does what, conceptualizing a program

Re: curses problem reading cursor keys

2006-10-07 Thread Simon Morgan
On Sat, 07 Oct 2006 13:12:33 +, Simon Morgan wrote: > import curses > > def main(scr): > status = curses.newwin(1, curses.COLS, 0, 0) status.bkgd('0') > status.refresh() > > list = curses.newwin(curses.LINES, curses.COLS, 1, 0) list.bkgd('X') > list.refresh() If I use scr.su

Re: Python to use a non open source bug tracker?

2006-10-07 Thread Aahz
In article <[EMAIL PROTECTED]>, Giovanni Bajo <[EMAIL PROTECTED]> wrote: > >Are you ever going to try and make a point which is not "you are not >entitled to have opinions because you do not act"? Your sarcasm is >getting annoying. And since I'm not trolling nor flaming, I think I >deserve a little

Job announcement Vienna&Graz Austria

2006-10-07 Thread le_wolk
Python and Java Developers for reseach project hired! More information below... Information Diffusion across Interactive Online Media http://www.idiom.at/ Four full-time research positions are now available at Graz University of Technology and Vienna University of Economics and Business Administ

Re: Help with first script please. files, directories, autocomplete

2006-10-07 Thread Rainy
[EMAIL PROTECTED] wrote: > Hello everyone. Hopefully someone can point me in the right direction > here. I'm wanting to write a script to open microsoft word and adobe > pdf documents . Here is a little background: > > At the company where I work (an inspection firm) all reports of > inspections a

Re: curses problem reading cursor keys

2006-10-07 Thread Rainy
Simon Morgan wrote: > On Sat, 07 Oct 2006 13:12:33 +, Simon Morgan wrote: > > > import curses > > > > def main(scr): > > status = curses.newwin(1, curses.COLS, 0, 0) status.bkgd('0') > > status.refresh() > > > > list = curses.newwin(curses.LINES, curses.COLS, 1, 0) list.bkgd('X') >

Re: How to execute a python script in .NET application

2006-10-07 Thread MC
Hi! dotNET can use (call) COM-servers In pywin, there are exemple of COM-server, in Python, who can run (on-the-fly) Python code. This give a way for run Python's scripts from dotNET, Excel, Word, Internet-Explorer (HTA), C#, etc. I have try all these things, with success. -- @-salutations

Re: n-body problem at shootout.alioth.debian.org

2006-10-07 Thread Peter Maas
Giovanni Bajo wrote: > Did you try using an old-style class instead of a new-style class? The original program has an old style class, changing it to a new style class increases run time by 25% (version is 2.4.3 btw). -- Regards/Gruesse, Peter Maas, Aachen E-mail 'cGV0ZXIubWFhc0B1dGlsb2cuZGU=\n

Encoding and norwegian (non ASCII) characters.

2006-10-07 Thread joakim . hove
Hello, I am having great problems writing norwegian characters æøå to file from a python application. My (simplified) scenario is as follows: 1. I have a web form where the user can enter his name. 2. I use the cgi module module to get to the input from the user: name = form["name"]

class print?

2006-10-07 Thread SpreadTooThin
Hi... Many python object can be printed simpy by saying: print obj what method(s) need to be implemented in my own classes such that print dumps the object? -- http://mail.python.org/mailman/listinfo/python-list

Re: class print?

2006-10-07 Thread Erik Max Francis
SpreadTooThin wrote: > Hi... Many python object can be printed simpy by saying: > print obj > what method(s) need to be implemented in my own classes such that print > dumps the object? __str__ -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20

ANN: SimpleJSONRPCServer

2006-10-07 Thread aum
Hi, I've built a module called SimpleJSONRPCServer, which is essentially the same as the familiar python library module SimpleXMLRPCServer, except that it uses the JSON-RPC protocol. For those unfamiliar with JSON-RPC - see www.json-rpc.org - it's an alternative to XML-RPC, offering most of its c

operator overloading + - / * = etc...

2006-10-07 Thread SpreadTooThin
Can these operators be overloaded? If so. How? -- http://mail.python.org/mailman/listinfo/python-list

need some regular expression help

2006-10-07 Thread Chris
I need a pattern that matches a string that has the same number of '(' as ')': findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = [ '((2x+2)sin(x))', '(log(2)/log(5))' ] Can anybody help me out? Thanks for any help! -- http://mail.python.org/mailman/listinfo/python-list

Re: n-body problem at shootout.alioth.debian.org

2006-10-07 Thread Peter Maas
Paul McGuire wrote: > The advance method is the most fertile place for optimization, since it is > called approximately n(n-1)/2 times (where n=2E7). I was able to trim about > 25% from the Python runtime with these changes: [...] My results: Your changes: 18% runtime decrease Your changes + o

Re: ANN: SimpleJSONRPCServer

2006-10-07 Thread Sybren Stuvel
aum enlightened us with: > I've built a module called SimpleJSONRPCServer, which is essentially > the same as the familiar python library module SimpleXMLRPCServer, > except that it uses the JSON-RPC protocol. Thanks a lot! I've used XML-RPC on a low-speed device, and it was way too slow. Sybren

Re: operator overloading + - / * = etc...

2006-10-07 Thread Sybren Stuvel
SpreadTooThin enlightened us with: > Can these operators be overloaded? Yes. > If so. How? Implement __add__, __sub__ etc. in the class that you want to be able to add, subtract, etc. Sybren -- Sybren Stüvel Stüvel IT - http://www.stuvel.eu/ -- http://mail.python.org/mailman/listinfo/pytho

Re: A critique of cgi.escape

2006-10-07 Thread Lawrence D'Oliveiro
Another useful function is this: def JSString(Str) : """returns a JavaScript string literal that evaluates to Str. Note I'm not worrying about non-ASCII characters for now.""" Result = [] for Ch in Str : if Ch == "\\" : Ch = ""

Re: operator overloading + - / * = etc...

2006-10-07 Thread Daniel Nogradi
> Can these operators be overloaded? > If so. How? > http://www.python.org/doc/ref/numeric-types.html HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Reminder re Talk Proposals for PyCon 2007

2006-10-07 Thread Jeff Rush
October has arrived and the deadline for submitting a proposal to give a talk at PyCon 2007 is October 31 (November 15 for tutorials). While it is a PyCon tradition to wait until the last minute to flood us with submissions, I would like to encourage presenters to start a bit earlier this year. W

Re: operator overloading + - / * = etc...

2006-10-07 Thread Tim Chase
>> Can these operators be overloaded? > > Yes. With the caveat of the "=" mentioned in the subject-line (being different from "==")...I haven't found any way to override assignment in the general case. There might be some oddball way to do it via property() but AFAIK, this only applies to pr

Re: Encoding and norwegian (non ASCII) characters.

2006-10-07 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Hello, > > I am having great problems writing norwegian characters æøå to file > from a python application. My (simplified) scenario is as follows: > > 1. I have a web form where the user can enter his name. > > 2. I use the cgi module module to get to the input from

Re: operator overloading + - / * = etc...

2006-10-07 Thread Georg Brandl
Tim Chase wrote: >>> Can these operators be overloaded? >> >> Yes. > > With the caveat of the "=" mentioned in the subject-line (being > different from "==")...I haven't found any way to override > assignment in the general case. There might be some oddball way > to do it via property() but A

Re: need some regular expression help

2006-10-07 Thread Diez B. Roggisch
Chris wrote: > I need a pattern that matches a string that has the same number of '(' > as ')': > findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = [ > '((2x+2)sin(x))', '(log(2)/log(5))' ] > Can anybody help me out? This is not possible with regular expressions - they can't "re

Re: Making sure script only runs once instance at a time.

2006-10-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Tim Williams wrote: > On 29/09/06, Matthew Warren <[EMAIL PROTECTED]> wrote: >> I have found that in real usage of other programs within the company that >> use lockfiles, it sometimes causes a bit of troubleshooting time when it >> stops working due to a stale lock

Re: switching to numpy and failing, a user story

2006-10-07 Thread Fernando Perez
[EMAIL PROTECTED] wrote: > After using numeric for almost ten years, I decided to attempt to > switch a large codebase (python and C++) to using numpy. Here's are > some comments about how that went. > > - The code to automatically switch python stuff over just kind of > works. But it was a 90% s

Re: operator overloading + - / * = etc...

2006-10-07 Thread Sybren Stuvel
Tim Chase enlightened us with: > With the caveat of the "=" mentioned in the subject-line (being > different from "==")...I haven't found any way to override > assignment in the general case. Why would you want to do that? Sybren -- Sybren Stüvel Stüvel IT - http://www.stuvel.eu/ -- http://ma

Re: need some regular expression help

2006-10-07 Thread John Machin
Chris wrote: > I need a pattern that matches a string that has the same number of '(' > as ')': > findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = [ > '((2x+2)sin(x))', '(log(2)/log(5))' ] > Can anybody help me out? > No, there is so such pattern. You will have to code up a func

Re: People's names (was Re: sqlite3 error)

2006-10-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > John Machin wrote: > > [lots of explanation about peculiarities of people's names] > > While I don't dispute any of this erudite display of esoteric > nomenclature wisdom the fact remains that many (predominantly Western) > databases do tend to

Re: operator overloading + - / * = etc...

2006-10-07 Thread Tim Chase
>> With the caveat of the "=" mentioned in the subject-line (being >> different from "==")...I haven't found any way to override >> assignment in the general case. > > Why would you want to do that? For the same reason one would use property() to create getter/setter functions for a particular v

Painless way to do 3D visualization

2006-10-07 Thread Peter Beattie
Hey folks, I need to do the following relatively simple 3D programming: I want to convert data from four-item tuples into 3D co-ordinates in a regular tetrahedron. Co-ordinates come in sequences of 10 to 20, and the individual dots in the tetrahedron need to be connected into discontinuous lines.

Re: Painless way to do 3D visualization

2006-10-07 Thread faulkner
http://www.vpython.org/ Peter Beattie wrote: > Hey folks, > > I need to do the following relatively simple 3D programming: > > I want to convert data from four-item tuples into 3D co-ordinates in a > regular tetrahedron. Co-ordinates come in sequences of 10 to 20, and the > individual dots in the

Re: IDLE - Customizing output format

2006-10-07 Thread Ilias Lazaridis
Gabriel Genellina wrote: > At Wednesday 27/9/2006 09:29, Ilias Lazaridis wrote: > > >import sys > >def f(obj): > > if obj: > > print '::: ' + repr(obj) > >sys.displayhook = f > > Have you tried that? You have to filter out None, not *any* False value. > > > > And notice that this replac

Re: Can't get around "IndexError: list index out of range"

2006-10-07 Thread MonkeeSage
On Oct 7, 12:37 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > for what? key in self.keys() And d.get() looks like sugar for: if self.has_key(key): return self[key] else: return default_value Why not have the same sugar for sequence types? E.g., def has_index(self, index):

Re: n-body problem at shootout.alioth.debian.org

2006-10-07 Thread igouy
Peter Maas wrote: > Paul McGuire wrote: > > The advance method is the most fertile place for optimization, since it is > > called approximately n(n-1)/2 times (where n=2E7). I was able to trim about > > 25% from the Python runtime with these changes: > [...] > > My results: > > Your changes: 18%

Re: IDLE - Customizing output format

2006-10-07 Thread Ilias Lazaridis
Ilias Lazaridis wrote: > IDLE has an output format like this: > > >>> object > > >>> type > > >>> object.__class__ > > >>> object.__bases__ > > How can I customize it to become like that: > > >>> object > > >>> type > > >>> object.__class__ > > >>> object.__bases__ > >

Re: People's names (was Re: sqlite3 error)

2006-10-07 Thread John Machin
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Steve > Holden wrote: > > > John Machin wrote: > > > > [lots of explanation about peculiarities of people's names] > > > > While I don't dispute any of this erudite display of esoteric > > nomenclature wisdom the fact remains that many (p

Re: Can't get around "IndexError: list index out of range"

2006-10-07 Thread Duncan Smith
MonkeeSage wrote: > On Oct 7, 12:37 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > >>for what? > > > key in self.keys() > [snip] No. The above constructs a list of keys and searches the list for the key, O(n). "key in somedict" is a lookup, O(1). Duncan -- http://mail.python.org/mailman

New-style classes slower than old-style classes? (Was: n-body problem at shootout.alioth.debian.org)

2006-10-07 Thread Giovanni Bajo
Peter Maas wrote: >> Did you try using an old-style class instead of a new-style class? > > The original program has an old style class, changing it to a new > style class increases run time by 25% (version is 2.4.3 btw). Ah yes. Years ago when I first saw this test it was still using new-style c

Re: Python to use a non open source bug tracker?

2006-10-07 Thread Giovanni Bajo
Aahz wrote: >> Are you ever going to try and make a point which is not "you are not >> entitled to have opinions because you do not act"? Your sarcasm is >> getting annoying. And since I'm not trolling nor flaming, I think I >> deserve a little bit more of respect. > > IMO, regardless of whether y

Re: Kde Taskbar

2006-10-07 Thread David Boddie
On Saturday 07 October 2006 15:41, Diez B. Roggisch wrote: > pykde afaik supports systray-iconified apps. And you could use the > dcop-mechanisms that are available as command line tools as well I > guess, and invoke knotify. I think DarkBlue wanted to affect the behaviour of the taskbar, though

Re: Can't get around "IndexError: list index out of range"

2006-10-07 Thread MonkeeSage
On Oct 7, 7:14 pm, Duncan Smith <[EMAIL PROTECTED]> wrote: > No. The above constructs a list of keys and searches the list for the > key, O(n). "key in somedict" is a lookup, O(1). My point wasn't in regard to implementation details, but in regard to convenience methods. Obviously the sugary d

  1   2   >