Python on Linux Cluster

2004-12-22 Thread Gurpreet Sachdeva
I have shifted my python script on a 4 node open ssi cluster. Please guide me what changes do I have to do in my python scripts to fully utilize the cluster. How do we introduce parralel processing in python??? -- Thanks and Regards, GSS -- http://mail.python.org/mailman/listinfo/python-list

Re: PHP vs. Python

2004-12-22 Thread Fredrik Lundh
Paul Rubin wrote: >> But pure speed is not the all. Python can scale better, > > If a system is fast enough on a single processor, it doesn't need to scale. the word "scale" doesn't necessarily imply performance. software developers also deal with scales like program size, application complexity

Re: list IndexError

2004-12-22 Thread Ishwor
On Thu, 23 Dec 2004 08:35:57 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Mike C. Fletcher wrote: > > >>yeah actually i saw what Fedrik had to say above. I created a sliced > >>copy of the l & did my homework within the for loop > >> > > You might want to check it again before you hand it in

Re: Lambda going out of fashion

2004-12-22 Thread Craig Ringer
On Thu, 2004-12-23 at 15:21, [EMAIL PROTECTED] wrote: > This is NOT true. Functional programming, AFAIKC, is a cool thing, and > in-fashion, increases productivity & readability, and an indispensable > thing for a flexible scripting lang. Couldn't agree more. One of the things I find most valuable

Re: Newbie namespace question

2004-12-22 Thread Nick Coghlan
Brandon wrote: Peter, You're correct about the bug. I did need a 'self' parm... I was just winging the example because the actual code is pretty large. I'm using google groups for my posting and it didn't carry spaces through (I did use spaces and not tabs). The "fix" or workaround was to import

Re: Lambda going out of fashion

2004-12-22 Thread Steven Bethard
[EMAIL PROTECTED] wrote: Well, you can say apply() is 'deprecated' now, (which is another functional thing I like), but I am still using it. Interesting. Could you explain why? Personally, I find the *expr/**expr syntax much simpler, so I'd be interested in knowing what motivates you to continu

Re: list IndexError

2004-12-22 Thread Fredrik Lundh
Mike C. Fletcher wrote: >>yeah actually i saw what Fedrik had to say above. I created a sliced >>copy of the l & did my homework within the for loop >> > You might want to check it again before you hand it in ;) ... > > >>> def ishwor( source ): > ... for item in source: > ... if item

Re: Lambda going out of fashion

2004-12-22 Thread Craig Ringer
On Thu, 2004-12-23 at 12:47, Keith Dart wrote: > On 2004-12-23, Stephen Thorne <[EMAIL PROTECTED]> wrote: > > Hi guys, > > > > I'm a little worried about the expected disappearance of lambda in > > python3000. I've had my brain badly broken by functional programming > > in the past, and I would hat

Re: Lambda going out of fashion

2004-12-22 Thread tanghaibao
This is NOT true. Functional programming, AFAIKC, is a cool thing, and in-fashion, increases productivity & readability, and an indispensable thing for a flexible scripting lang. The inline/lambda function is feature is shared by many lang. which I frequently use, MATLAB/R/Python/etc. Well, you can

Re: A rational proposal

2004-12-22 Thread Nick Coghlan
Mike Meyer wrote: Actually, I suggested that: float() + Rational() returns float You're suggesting that the implicit conversion to float not happen here, and the user be forced to cast it to float? And you're saying Decimal does it that way.[ Yup. I had another look at PEP 327 (the section on impli

Re: The limitation of the Photon Hypothesis

2004-12-22 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: I definitely have no rights to judge this article but I have a vague idea that this fine article goes to a wrong place. Except that the topic thing is symbolically related: Photon hYpoTHesis limitatiON. It's a well-known and persistent crank. -- Erik Max Francis && [EMAIL P

Re: The limitation of the Photon Hypothesis

2004-12-22 Thread tanghaibao
I definitely have no rights to judge this article but I have a vague idea that this fine article goes to a wrong place. Except that the topic thing is symbolically related: Photon hYpoTHesis limitatiON. -- http://mail.python.org/mailman/listinfo/python-list

Re: PHP vs. Python

2004-12-22 Thread Craig Ringer
On Thu, 2004-12-23 at 06:03, [EMAIL PROTECTED] wrote: > Anyone know which is faster? I'm a PHP programmer but considering > getting into Python ... did searches on Google but didn't turn much up > on this. Others have answered interpretations of your question other than execution speed. I can't g

Re: Killing a python thread with a signal

2004-12-22 Thread Craig Ringer
On Thu, 2004-12-23 at 04:51, James Lamanna wrote: > So I've created a thread with the threading.Thread class, but I want to > be able to kill this thread because it does a select() with a timeout of > None. I recall seeing various discussion of signals and threading on the list in the past - it

Re: Lambda going out of fashion

2004-12-22 Thread Steven Bethard
Stephen Thorne wrote: { 'one': lambda x:x.blat(), 'two': lambda x:x.blah(), }.get(someValue, lambda x:0)(someOtherValue) The alternatives to this, reletively simple pattern, which is a rough parallel to the 'switch' statement in C, involve creating named functions, and remove the code from the co

Re: Mutable objects which define __hash__ (was Re: Why are tuples immutable?)

2004-12-22 Thread Nick Coghlan
Steven Bethard wrote: Of course, if rehash worked in place, you could probably do some optimizations to only rehash the necessary items. Yep, especially given this little critter from dictobject.h which contains everything needed to spot mutated objects: typedef struct { long me_hash;

The limitation of the Photon Hypothesis

2004-12-22 Thread bill
The limitation of the Photon Hypothesis According to the electromagnetic theory of light, its energy is related to the amplitude of the electric field of the electromagnetic wave, W=eE^2V(where E is the amplitude and V is the volume). It apparently has nothing to do with the light's fre

Re: Mutable objects which define __hash__ (was Re: Why are tuples immutable?)

2004-12-22 Thread Nick Coghlan
Jeff Shannon wrote: To be honest, given how easy it is to key a current dict off of object id, I don't see much real value in creating a separate dict type that does it by default. But as long as it's an addition, rather than a change to existing behavior, then the only real problem with it is

effbot TidyHTMLTreeBuilder problem

2004-12-22 Thread dayzman
Hi all, I'm using TidyHTMLTreeBuilder to model syntax structure of HTML documents. I've been trying to feed in Yahoo and CNN, but the parser seems to crash: " File "C:\Python23\Lib\site-packages\elementtidy\TidyHTMLTreeBuilder.py", line 89, in parse return ElementTree.parse(source, TreeBuilder()

Re: PHP vs. Python

2004-12-22 Thread Eric Pederson
Paul Rubin did say: > For sites that get less traffic than that, they only reason they need > to scale if they're written in Python is that Python is too slow. Asked earnestly: is there a feel or quantification that Python is slower than PHP in network applications? If, so, I am wondering if i

Re: mathmatical expressions evaluation

2004-12-22 Thread Tonino
thanks all for the info - and yes - speed is not really an issue and no - it is not an implementation of a complete financial system - but rather a small subset of a investment portfolio management system developed by "another company" ... What I am trying to achieve is to parse a formula(s) and g

Re: Lambda going out of fashion

2004-12-22 Thread Keith Dart
On 2004-12-23, Stephen Thorne <[EMAIL PROTECTED]> wrote: > Hi guys, > > I'm a little worried about the expected disappearance of lambda in > python3000. I've had my brain badly broken by functional programming > in the past, and I would hate to see things suddenly become harder > than they need to

time zone

2004-12-22 Thread Kiran Vasu
how to set my mails recieving time to my local time(i am in malaysia) -- http://mail.python.org/mailman/listinfo/python-list

Re: Howto Extract PNG from binary file @ 0x80?

2004-12-22 Thread Aaron
On Sat, 11 Dec 2004 10:53:19 +0100, Fredrik Lundh wrote: > "flamesrock" <[EMAIL PROTECTED]> wrote: > >> As a newbie to the language, I have no idea where to start..please bare >> with me.. >> >> The simcity 4 savegame file has a png image stored at the hex location >> 0x80. What I want to extract

Lambda going out of fashion

2004-12-22 Thread Stephen Thorne
Hi guys, I'm a little worried about the expected disappearance of lambda in python3000. I've had my brain badly broken by functional programming in the past, and I would hate to see things suddenly become harder than they need to be. An example of what I mean is a quick script I wrote for doing c

Weekly Python Patch/Bug Summary

2004-12-22 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 257 open ( -2) / 2715 closed ( +8) / 2972 total ( +6) Bugs: 807 open (-15) / 4717 closed (+32) / 5524 total (+17) RFE : 163 open ( +3) / 139 closed ( +0) / 302 total ( +3) New / Reopened Patches __ sgmllib.S

Re: PHP vs. Python

2004-12-22 Thread Paul Rubin
Jeremy Bowers <[EMAIL PROTECTED]> writes: > Your point is circular; "fast enough (right now)" can be defined as > "doesn't need to scale (right now)". > > For any given server app, enough clients will bog it down. If you're > trying to claim that PHP has less trouble with this, I've seen a lot of

Re: Installing new version, erasing previous versions of Python

2004-12-22 Thread Maurice LING
Hi David, I'm using Python on Mac OSX and although my case is not precisely your scenario but it is pretty common to have more than 1 pythons installed in Mac OSX 10.3, if Fink is used. If I understand the above correctly, 1) "make install" and "make altinstall" use the same process, the only di

Re: PHP vs. Python

2004-12-22 Thread Jeremy Bowers
On Wed, 22 Dec 2004 16:43:21 -0800, Paul Rubin wrote: > JZ <[EMAIL PROTECTED]> writes: >> But pure speed is not the all. Python can scale better, > > If a system is fast enough on a single processor, it doesn't need to scale. Your point is circular; "fast enough (right now)" can be defined as "d

Re: PHP vs. Python

2004-12-22 Thread Robert Kern
Paul Rubin wrote: JZ <[EMAIL PROTECTED]> writes: But pure speed is not the all. Python can scale better, If a system is fast enough on a single processor, it doesn't need to scale. I think he means, "scale to larger programs," not "scale to more processors." -- Robert Kern [EMAIL PROTECTED] "In

(Mac-specific) AppScript bug

2004-12-22 Thread George van den Driessche
(This is really for Hamish Sanderson, I think, but I can't find an e-mail address for him.) On OS X 10.3.7, with XCode 1.5 and all the latest AppScript packages installed, writing this: a = appscript.app( 'XCode.app' ) causes a crash in terminology.py: /System/Library/Frameworks/Python.framewo

Re: Problem with msvcrt60 vs. msvcr71 vs. strdup/free

2004-12-22 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: And so I suspect this approach (compiling sources yourself) can shield people from this ugly mess, if they can build Python 2.4 and the extensions and have them (core and extension) use one and the same run-time library. But indeed this might be an issue for those who [1] u

Re: PHP vs. Python

2004-12-22 Thread huy
[EMAIL PROTECTED] wrote: Anyone know which is faster? I'm a PHP programmer but considering getting into Python ... did searches on Google but didn't turn much up on this. Thanks! Stephen Is PHP too slow for your needs ? Is that the reason for changing ? If it is, then Python might not satisfy you

Re: Problem with msvcrt60 vs. msvcr71 vs. strdup/free

2004-12-22 Thread abkhd
Martin v. Löwis wrote: > Indeed, it *will* work most of the time, as you rarely pass resources > across CRTs in a typical Python extension. However, it is very hard > to tell from the source code of the extension if such resource passing > could ever happen (e.g. what about setlocale(), atexit(), m

Re: Python To Send Emails Via Outlook Express

2004-12-22 Thread ian
Hi Lenard, As the risk of severely embarassing myself can I ask for your help one more time. I have tried changing your script to include attachments, but guess what, (and this should come as no suprise) I can't do it. So Here is my feeble attempt at changing the script.. -

Re: wxPython help

2004-12-22 Thread Scott David Daniels
km wrote: Hi all, i am trying out some of the demo programs in wxPython. but i am getting an error: no module 'run' how do i circumvent this module and run the program with main.Loop() ? tia, KM The easiest way is to copy "C:\Program Files\wxPython2.5 Docs and Demos\demo\run.py" (run.py from t

Re: regular expression: perl ==> python

2004-12-22 Thread Stephen Thorne
On 22 Dec 2004 17:30:04 GMT, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > Is there an easy way round this? AFAIK you can't assign a variable in > a compound statement, so you can't use elif at all here and hence the > problem? > > I suppose you could use a monstrosity like this, which relies on t

Re: PHP vs. Python

2004-12-22 Thread Paul Rubin
JZ <[EMAIL PROTECTED]> writes: > But pure speed is not the all. Python can scale better, If a system is fast enough on a single processor, it doesn't need to scale. -- http://mail.python.org/mailman/listinfo/python-list

Re: PHP vs. Python

2004-12-22 Thread JZ
Dnia 22 Dec 2004 14:03:36 -0800, [EMAIL PROTECTED] napisał(a): > Anyone know which is faster? I'm a PHP programmer but considering > getting into Python ... Python application servers (Webware, Skunkweb) can work much faster than php. But it is true only for non-trivial code. Benchmark for "Hel

Re: Is this a good use for lambda

2004-12-22 Thread Terry Reedy
"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Although if you genuinely prefer a functional programming style, > I'd go with Terry's answer rather than mine. The 'iterative' version can also be written recursively, which to most is functional. For me, the import

Re: PHP vs. Python

2004-12-22 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: >Anyone know which is faster? I'm a PHP programmer but considering >getting into Python ... did searches on Google but didn't turn much up >on this. For web service, the first hurdle is picking which python web interface to use, installi

Re: PHP vs. Python

2004-12-22 Thread Stephen Thorne
On 22 Dec 2004 14:03:36 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Anyone know which is faster? I'm a PHP programmer but considering > getting into Python ... did searches on Google but didn't turn much up > on this. In terms of development, Python is a far better language to write cod

Re: Metaclasses

2004-12-22 Thread Shalabh Chaturvedi
[EMAIL PROTECTED] wrote: I am trying to build a capability based API. That is, an instance of the api will reflect the capabilities of some underlying services. The question I'd ask at this point is - does the term 'instance of the API' correspond to a Python class, or an instance of the class th

Re: Best GUI for small-scale accounting app?

2004-12-22 Thread huy
Dave Cook wrote: On 2004-12-20, Paul Rubin wrote: I think I can put together a useable (but not visually stunning) web interface faster than I can put together any pure client-side interface. Web browser "widgets" seem pretty limited to me, though. You don't even have something as simple as a

Re: PHP vs. Python

2004-12-22 Thread Michel Claveau - abstraction méta-galactique non triviale en fuite perpétuelle.
Hi ! Relative in Python (and for local use), PHP is a tortoise with of a hand brake. -- http://mail.python.org/mailman/listinfo/python-list

Re: word to digit module

2004-12-22 Thread John Machin
Stephen Thorne wrote: > Thankyou for you feedback, both of you. No wuckas. > http://thorne.id.au/users/stephen/scripts/eng2num.py contains your suggestions. This points to some javascript which prints "No." -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question - default values of a function

2004-12-22 Thread Bulba!
Thanks everyone (esp. Fredrik, http://www.effbot.org/zone/index.htm contains lotsa goodies by him I intend to study), I'm going offline to reboot my brain. ;-) -- It's a man's life in a Python Programming Association. -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expression: perl ==> python

2004-12-22 Thread John Machin
Fredrik Lundh wrote: > John Machin wrote: > > > >> > I forgot to add: I am using Python 2.3.4/Win32 (from ActiveState.com). The > >> > code works in my interpreter. > >> > >> only if you type it into the interactive prompt. see: > > > > No, it doesn't work at all, anywhere. Did you actually try

Re: list IndexError

2004-12-22 Thread Mike C. Fletcher
Ishwor wrote: ... I believe lamda's are unnamed functions aren't they?? Still learning... ;-) Yes. yeah actually i saw what Fedrik had to say above. I created a sliced copy of the l & did my homework within the for loop You might want to check it again before you hand it in ;) ... >>> def ish

Problem with os.listdir and delay with unreachable network drives on Windows

2004-12-22 Thread Read Roberts
I wrote my own directory browser in order to get around a bug where tkFileDialog.askdirectory() can't handle non-ascii paths. However, I have a problem where I call os.listdir() on a mapped network drive, e.g. os.listdir("Z:\\"), and if the network drive is unavailable, the UI hangs until th

Re: Skinnable/Stylable windows in wxPython?

2004-12-22 Thread Roel Schroeven
Daniel Bickett wrote: Not only would this make it more multi-platform (I have no access to a GTK machine so I don't know if this works. Could someone please check?) Looks like it works (I had to change frame.Show() to frame.Show(1) though, but that could be because it's an old version). No, I thin

Re: Python for Series 60 update

2004-12-22 Thread Tim Hoffman
Whoo hoo. Just got it. I did find a problem with it on my 7610. It has a python program called bt_console.py which allows you to start a ptyhon shell, but its I/O is redirected over Bluetooth to a terminal on a PC (ie Hyper Term) It goves you have access to the Python shell with a decent keyboard a

Re: extract news article from web

2004-12-22 Thread Zhang Le
Thanks for the hint. The xml-rpc service is great, but I want some general techniques to parse news information in the usual html pages. Currently I'm looking at a script-based approach found at: http://www.namo.com/products/handstory/manual/hsceditor/ User can write some simple template to extrac

Re: Newbie question - default values of a function

2004-12-22 Thread Fredrik Lundh
"Bulba!" wrote: > Surely the variable i is a mutable object? nope. > OK, again: > def t(a,i=[0]): > ... i[0]=i[0]+1 > ... return (a, i) > ... t(1) > (1, [1]) t(3) > (3, [2]) t(5) > (5, [3]) > > Yes, it works with the list. But why sharing value between calls > pertains some m

Re: Help to find a library...

2004-12-22 Thread Fredrik Lundh
"whamoo" wrote >> > I'm looking for a library like ncurses, but that can be used also on >> > windows in a very simple way... >> > >> > There is some library that do some like curses? >> >> here's one: >> >> http://www.effbot.org/zone/console-index.htm > > Thanks for this library, but i was lookin

Re: Newbie question - default values of a function

2004-12-22 Thread Bulba!
On Wed, 22 Dec 2004 22:29:44 GMT, "Matt Gerrans" <[EMAIL PROTECTED]> wrote: >Actually i was not mutable. Try this: >i = 1 >id(i) >i += 1 >id(i) Looks like I will have to read the Language Reference anyway. :-( >Because you are assigning the local reference variable L to a new list, >instead

Re: list IndexError

2004-12-22 Thread M.E.Farmer
Hello Ishwor , The simpliest way I can explain slicing is that the slices point to the spot *between* the items.. Take this list for example slicer = [0,1,2,3,4,5] >>> slicer [1] 1 >>> slicer [1:2] [1] >>> slicer [:-1] [0,1,2,3,4] >>> slicer[2,4] [2,3] Hth, M.E.Farmer -- http://mail.pyth

Re: Help to find a library...

2004-12-22 Thread whamoo
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > "whamoo" <[EMAIL PROTECTED]> wrote: > > > I'm looking for a library like ncurses, but that can be used also on > > windows in a very simple way... > > > > There is some library that do some like curses? > > here's one: > > http://www.effbot.org/zone/co

Re: PHP vs. Python

2004-12-22 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Anyone know which is faster? I'm a PHP programmer but considering > getting into Python ... faster for what? in my experience, people can hack into a PHP site in no time at all, but maybe you meant something else? (seriously, it depends on what you're doing, of cours

Re: Newbie question - default values of a function

2004-12-22 Thread Matt Gerrans
Actually i was not mutable. Try this: i = 1 id(i) i += 1 id(i) Change both of your sample functions to also print the id of the default variable and that might shed a little more light on the matter. "i = i + 1" is only changing the local reference called i to refer to an instance of a diffe

Re: PHP vs. Python

2004-12-22 Thread Marek Baczynski
That depends what you consider faster. PHP will save you some q&d hacking time, but Python will save you more in the longer term IMHO. For the other speed, see http://shootout.alioth.debian.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question - default values of a function

2004-12-22 Thread Dennis Benzinger
Bulba! wrote: > [...] > But why the following happens? > > def j(a,i=0): > > ... i=i+1 > ... return (a, i) > ... > j(2) > > (2, 1) > j(3) > > (3, 1) > j(5) > > (5, 1) > > > From Language Reference: > > http://www.python.org/doc/2.3.4/ref/function.html > > "Default

Re: A rational proposal

2004-12-22 Thread Mike Meyer
Nick Coghlan <[EMAIL PROTECTED]> writes: > Actually, I was misremembering how Decimal worked - it follows the rule you > suggest: > > float() + Decimal() fails with a TypeError > float() + float(Decimal()) works fine > > And I believe Decimal's __float__ operation is a 'best effort' kind of > thi

Re: Help to find a library...

2004-12-22 Thread Fredrik Lundh
"whamoo" <[EMAIL PROTECTED]> wrote: > I'm looking for a library like ncurses, but that can be used also on > windows in a very simple way... > > There is some library that do some like curses? here's one: http://www.effbot.org/zone/console-index.htm -- http://mail.python.org/mailman/listi

Re: list IndexError

2004-12-22 Thread Ishwor
On Wed, 22 Dec 2004 21:42:16 GMT, Steven Bethard <[EMAIL PROTECTED]> wrote: > Ishwor wrote: > > i am trying to remove an item 'e' from the list l > > I thought it might be helpful to code some of the alternatives you've > been given and look at the timings to put things into perspective. The > co

Re: Tabnanny really useful?

2004-12-22 Thread JanC
Steve Holden schreef: > Sounds like WingIDE to me. I'm a recent convert, but one feature that > impressed me was the instant warning I got when I indented code with > spaces in a tab-oriented source file. >From the SciTE/Scintilla docs: | tab.timmy.whinge.level | | For Python code, checks whe

Newbie question - default values of a function

2004-12-22 Thread Bulba!
OK. Don't laugh. There's this example from tutorial, showing how default value is computed once when defining function and shared between function calls: --- def f(a, L=[]): L.append(a) return L print f(1) print f(2) print f(3) This will print [1] [1, 2] [1, 2, 3] --- (Pyth

PHP vs. Python

2004-12-22 Thread stephen . mayer
Anyone know which is faster? I'm a PHP programmer but considering getting into Python ... did searches on Google but didn't turn much up on this. Thanks! Stephen -- http://mail.python.org/mailman/listinfo/python-list

Re: Why no list heritable type?

2004-12-22 Thread Dave Benjamin
Mike Meyer wrote: "Robert Brewer" <[EMAIL PROTECTED]> writes: Why aren't built in lists and dictionaries real heritable types that can save this kind of patchwork? They are since Python 2.2 (IIRC): And before Python 2.2 there was the UserList class in the standard library. Which is still there in

Re: regular expression: perl ==> python

2004-12-22 Thread Fredrik Lundh
John Machin wrote: > >> > I forgot to add: I am using Python 2.3.4/Win32 (from ActiveState.com). The >> > code works in my interpreter. >> >> only if you type it into the interactive prompt. see: > > No, it doesn't work at all, anywhere. Did you actually try this? the OP claims that it works in

Re: [Re: newbie question]

2004-12-22 Thread Doug Holton
Ed Leafe wrote: You've missed the obvious: it's 'criticism' or 'observation' when it comes from Doug, but it's a 'flame' when it is directed at Doug. > Unless there is something more substantial then whining, howzabout we all just ignore it and let it die a quick death? It's amazing how m

Re: list IndexError

2004-12-22 Thread Steven Bethard
Ishwor wrote: i am trying to remove an item 'e' from the list l I thought it might be helpful to code some of the alternatives you've been given and look at the timings to put things into perspective. The code: remove.py def remove_lc(x, lst): lst[:

Re: word to digit module

2004-12-22 Thread Stephen Thorne
On Wed, 22 Dec 2004 11:41:26 -0800, Scott David Daniels <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > Stephen Thorne wrote: > > .def toNumber2(s): > > . items = s.replace(',', '').split() > > . numbers = [translation.get(item.strip(), -1) for item in items if > > item.strip()] > > . sta

Re: list IndexError

2004-12-22 Thread Ishwor
On Thu, 23 Dec 2004 07:27:52 +1000, Egor Bolonev <[EMAIL PROTECTED]> wrote: > On Thu, 23 Dec 2004 06:56:02 +1030, Ishwor <[EMAIL PROTECTED]> wrote: > > l > > ['a', 'b', 'c', 'd', 'e'] > for x in l[:]: > >if x == 'd': > >l.remove('d'); > > > l > > ['a', 'b', '

Re: list IndexError

2004-12-22 Thread Egor Bolonev
On Thu, 23 Dec 2004 06:56:02 +1030, Ishwor <[EMAIL PROTECTED]> wrote: l ['a', 'b', 'c', 'd', 'e'] for x in l[:]: if x == 'd': l.remove('d'); l ['a', 'b', 'c', 'e'] This code is so clean and looks very healthy. Python will live a long way because its a cute language. imho the

Re: how to start a new process while the other ist running on

2004-12-22 Thread Keith Dart
On 2004-12-22, Erik Geiger <[EMAIL PROTECTED]> wrote: > Donn Cave schrieb: > >> In article <[EMAIL PROTECTED]>, Erik Geiger <[EMAIL PROTECTED]> >> wrote: > [...] >> > Thats what I've tried, but it did not work. Maybe it's because I want to >> > start something like su -c '/path/to/skript $parameter

Re: Skinnable/Stylable windows in wxPython?

2004-12-22 Thread Daniel Bickett
> > Not only would this make it more multi-platform (I have no access to > > a GTK machine so I don't know if this works. Could someone please > > check?) > > Looks like it works (I had to change frame.Show() to frame.Show(1) > though, but that could be because it's an old version). No, I think t

Re: word to digit module

2004-12-22 Thread M.E.Farmer
Cool script just one little thing, toNumber('One thousand') bites the dust. Guess you should add another test, and s.lower() ;) Stephen Thorne wrote: {code snip} > def toNumber(s): + s = s.lower() > items = s.replace(',', '').split() > numbers = [translation.get(item.strip(), -1) for i

Help to find a library...

2004-12-22 Thread whamoo
Hello, I'm looking for a library like ncurses, but that can be used also on windows in a very simple way... There is some library that do some like curses? Thanks a lot -- Whamoo www.rknet.it Powerd by: MacOsX, Gnu/Linux Debian Sarge, Amiga Os 3.9, Milk. -- http://mail.python.org/mailman/list

Re: MIDI (was - Re: BASIC vs Python)

2004-12-22 Thread JanC
Bob van der Poel schreef: > Just as a side note, I remember reading somewhere that the Casio WK3000 > Keyboard uses Python. Not sure if that's internal or just for Casio's > own development. At the bottom it says: | 2. Python Programming Language

Re: Garbage collector strategy

2004-12-22 Thread "Martin v. Löwis"
Martin Drautzburg wrote: Just for curiosity: does python use a mark-and-sweep garbage collector or simple reference counting? I can't resist: Yes, it does. In the latter case it would not garbage collect circular references, right ? Python uses refcounting for all objects, and a generational colle

Re: mathmatical expressions evaluation

2004-12-22 Thread beliavsky
Paul McGuire wrote: >And I wouldn't necessarily agree with beliavsky's assertion that numarray >arrays are needed to represent payment dates and amounts, unless you were >going to implement a major banking financial system in Python. Maybe arrays are not "needed", but especially for vectors of flo

Re: mathmatical expressions evaluation

2004-12-22 Thread John Machin
Paul McGuire wrote: > Here's > a simple loan amortization schedule generator: > > def amortizationSchedule( principal, term, rate ): > pmt = ( principal * rate * ( 1 + rate)**term ) / (( 1 + rate)**term - 1) Simpliciter: pmt = principal * rate / (1 - (1 + rate)**(-term)) > pmt = round(pm

Re: Problem with msvcrt60 vs. msvcr71 vs. strdup/free

2004-12-22 Thread "Martin v. Löwis"
[EMAIL PROTECTED] wrote: Believe it or not I do not get a crash here. I can believe this. strdup does malloc, i.e. gets some memory from the heap, and free puts it back into the heap. Since this is a different CRT, it puts it back into a different heap. This is a leak, but it should not cause a cra

Killing a python thread with a signal

2004-12-22 Thread James Lamanna
So I've created a thread with the threading.Thread class, but I want to be able to kill this thread because it does a select() with a timeout of None. Is there any way to send a signal only to this thread and wake it up from the select? Thanks. Please CC me for I am not subscribed. -- James La

Re: Newbie namespace question

2004-12-22 Thread Brandon
Peter, You're correct about the bug. I did need a 'self' parm... I was just winging the example because the actual code is pretty large. I'm using google groups for my posting and it didn't carry spaces through (I did use spaces and not tabs). The "fix" or workaround was to import __builtin__

Re: how to start a new process while the other ist running on

2004-12-22 Thread Erik Geiger
Donn Cave schrieb: > In article <[EMAIL PROTECTED]>, Erik Geiger <[EMAIL PROTECTED]> > wrote: [...] > > Thats what I've tried, but it did not work. Maybe it's because I want to > > start something like su -c '/path/to/skript $parameter1 $parameter2' > > user > Unfortunately this particular case

Re: BASIC vs Python

2004-12-22 Thread Andrew Dalke
Jan Dries: > The funny thing is, for me, MIDI is dead old. One of my first computers, > back in 1986, was an Atari ST. It came equiped with a MIDI port. While the time I was talking about was some 3 or 4 years before 1986. > I seem to remember that even then we still had to rely on a keyboard

RE: Metaclasses

2004-12-22 Thread Robert Brewer
Bob Cowdery wrote: > What I want to do is when > > class API(object): > __metaclass__ = MetaAPI > > is created that MetaAPI generates attributes from a given > capability map and not the one it picked up on 'import'. Okay. It depends on where you're getting that capability information from,

Re: extract news article from web

2004-12-22 Thread Steve Holden
Steve Holden wrote: [...] However, the code to extract the news is pretty simple. Here's the whole program, modulo newsreader wrapping. It would be shorter if I weren't stashing the extracted links it a relational database: [...] I see that, as is so often the case, I only told half the story,

a question about socket objects

2004-12-22 Thread Dag Hansteen
Hello,   I have a question: How do I append a socket object into a list "manually" without appending the variable which the socket object is stored in, but just the socket object itself if I somehow know the address(pretend like)? I dont "need" this in any way for my code, but I would like

Re: Newbie namespace question

2004-12-22 Thread Peter Hansen
Brandon wrote: Thanks, that worked to get me past the "problem". Did you see my post regarding my issue? I just know that there's a "Python way" to resolve my issue, so if anyone has a better way, I'm really interested. Not only does it feel like a hack, it looks like one too! Even worse! If you

Re: Python for Series 60 update

2004-12-22 Thread Michel Claveau - abstraction méta-galactique non triviale en fuite perpétuelle.
Hi ! Thanks ; and good news : I, finally, could register me into the Nokia's forums, and I, finally, could to download the package. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie namespace question

2004-12-22 Thread Peter Hansen
deelan wrote: i believe that to avoid circular refs errors remember you can lazy-import, for example here i'm importing the email package: m = __import__('email') m check help(__import__) for futher details. I'm not sure what you think that does, but I don't think it does it. The code you show

Re: list IndexError

2004-12-22 Thread Ishwor
On Wed, 22 Dec 2004 14:59:32 -0500, Mike C. Fletcher <[EMAIL PROTECTED]> wrote: [snip] > > Probably the most pythonic approach to this problem when dealing with > small lists is this: > >result = [ item for item in source if item != 'e' ] > > or, if you're using an older version of Python wit

Re: extract news article from web

2004-12-22 Thread Steve Holden
Zhang Le wrote: Hello, I'm writing a little Tkinter application to retrieve news from various news websites such as http://news.bbc.co.uk/, and display them in a TK listbox. All I want are news title and url information. Since each news site has a different layout, I think I need some template-base

Re: regular expression: perl ==> python

2004-12-22 Thread John Machin
Fredrik Lundh wrote: > "JZ" wrote: > > > >> import re > > >> line = "The food is under the bar in the barn." > > >> if re.search(r'foo(.*)bar',line): > > >> print 'got %s\n' % _.group(1) > > > > > > Traceback (most recent call last): > > > File "jz.py", line 4, in ? > > > print 'got %s\n'

Re: mathmatical expressions evaluation

2004-12-22 Thread Paul McGuire
"Tonino" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I have a task of evaluating a complex series (sorta) of mathematical > expressions and getting an answer ... > > I have looked at the numarray (not really suited??) and pythonica (too > simple??) and even tried using eva

RE: Best GUI for small-scale accounting app?

2004-12-22 Thread Gabriel Cosentino de Barros
Title: RE: Best GUI for small-scale accounting app? > I went w/wxPython for a second app because of its printing capabilities > and the large number of controls that come with it.  Otherwise I would > use pyFltk for small apps. does FLK has any good positioning model now? Last time i checked

Re: list IndexError

2004-12-22 Thread Mike C. Fletcher
Ishwor wrote: i am trying to remove an item 'e' from the list l but i keep getting IndexError. I know the size of the list l is changing in the for loop & its sort of trivial task but i found no other way than to suppress the IndexError by doing a pass. any other ways you guys can suggest? Also is

  1   2   3   >