Re: Why are tuples immutable?

2004-12-22 Thread Steven Bethard
Antoon Pardon wrote: Well the only suggestion I would make now is that it would be nice to have a second dict type that would make a copy of a key and insert that copy in the dictionary. (At least) two options here, depending on what you really need. (1) Use current dicts. They will still give you

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

2004-12-22 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Erik Geiger <[EMAIL PROTECTED]> wrote: > Fredrik Lundh schrieb: > > > Erik Geiger wrote: > > > [...] > >> How to start a shell script without waiting for the exit of that shell > >> script? It shall start the shell script and immediately execute the next > >> pyth

Re: Why are tuples immutable?

2004-12-22 Thread Jeff Shannon
Antoon Pardon wrote: Op 2004-12-21, Jeff Shannon schreef <[EMAIL PROTECTED]>: How does the dict know which value is associated with which key? Because there is a link between the key and the value. The problem with a mutated key in a dictionary is not that the link between the key and the va

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

2004-12-22 Thread Steven Bethard
Nick Coghlan wrote: The longer I consider it, the more this seems like a valid analogy. There is nothing preventing dictionaries from having a rehash() method. Consider: # Mutate some value in mylist mylist.sort() # Mutate some key in mydict mydict.rehash() Well, you can already get the equivalen

Re: trouble building python2.4

2004-12-22 Thread Tim Peters
[Matthew Thorley] >> I have got to be the stupidest person on the face of the planet. [Steve Holden] > I'll have you know I don't welcome newcomers to this newsgroup > trying to steal my hard-won reputation, if you don't mind. In all fairness, Matthew did present evidence to support his claim. F

Source cross reference + colourizer (PyXR is no more?)

2004-12-22 Thread Roger Binns
I have been a happy user of PyXR which colourizes source to HTML and also cross references it. Here is an example of the output: http://bitpim.org/pyxr/c/projects/bitpim/analyser.py.html Unfortunately the author and his site appears to have gone AWOL for quite a while. It used to be: http:

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

2004-12-22 Thread Jeff Shannon
Nick Coghlan wrote: I have a different suggestion: an identity dictionary. It ignores __hash__, __cmp__ and __eq__, and instead uses id() and is. This might be useful in some special cases, though it's pretty easy to use a standard dict and explicitly use object ids as keys ( d[id(myobj)] = ...

Re: How about "pure virtual methods"?

2004-12-22 Thread Jeff Shannon
Fredrik Lundh wrote: Noam Raphael wrote: Oh, and another thing - maybe "abstract" is a better name than "notimplemented"? notimplemented might suggest a method which doesn't have to be implemented - and raises NotImplementedError when it is called. What do you think? what's the difference

Re: Python To Send Emails Via Outlook Express

2004-12-22 Thread Lenard Lindstrom
[EMAIL PROTECTED] writes: > Hi Lenard, > Absolutely fantastic!! > That worked like a charm. > Now onto adapting it to send attachments. > Glad to be of help. Lenard Lindstrom -- http://mail.python.org/mailman/listinfo/python-list

Re: File locking is impossible in Windows? SOLUTION

2004-12-22 Thread elbertlev
Sure it will do if one of the processes needs read access only. Scenario when you need shared rw acces with locking: In the file you have "records" say 30 bytes long, 2 processes are reading/writing these records by: lock-read-unlock or lock-write-unlock . Both processes have to open the file with

Re: error problems for import some copora with nltk

2004-12-22 Thread [EMAIL PROTECTED]
Dear Tony.Meyer, Thank you for answering this. I did exactly what you told me, but I got following messages. Do you have any idea? = >>> import nltk >>> from nltk.corpus import gutenberg Traceback (most recent call last)

Re: Newbie namespace question

2004-12-22 Thread Jeff Shannon
[EMAIL PROTECTED] wrote: Now, in jdbc.py I have #jdbc.py class DataSource: def __init__(self, servername): self.servername = servername def create(name, connectionInfo, etc): #Call the IBM supplied WebSphere config object AdminConfig.create('DataSource') Run it and get a name error, which, makes se

Jython performance

2004-12-22 Thread Gabriel Cosentino de Barros
Title: Jython performance On the "Best GUI for small-scale accounting app?" tread some people mentioned jython. I went to read about it, but i was wondering if anyone has any real project done with it and can give real world comments about performance. Thanks, Gabriel -- http://mail.pytho

Re: regular expression: perl ==> python

2004-12-22 Thread Fredrik Lundh
Nick Craig-Wood wrote: > I've found that a slight irritation in python compared to perl - the > fact that you need to create a match object (rather than relying on > the silver thread of $_ (etc) running through your program ;-) the old "regex" engine associated the match with the pattern, but th

Re: error problems for import some copora with nltk

2004-12-22 Thread Jeff Shannon
[EMAIL PROTECTED] wrote: Dear Tony.Meyer, Thank you for answering this. I did exactly what you told me, but I got following messages. Do you have any idea? = import nltk from nltk.corpus import gutenberg Traceba

Re: Jython performance

2004-12-22 Thread Sean Blakey
On Wed, 22 Dec 2004 17:03:55 -0200, Gabriel Cosentino de Barros <[EMAIL PROTECTED]> wrote: > > > On the "Best GUI for small-scale accounting app?" tread some people > mentioned jython. I went to read about it, but i was wondering if anyone has > any real project done with it and can give real wo

Re: error problems for import some copora with nltk

2004-12-22 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > Thank you for answering this. I did exactly what you told me, but I got > following messages. > > Do you have any idea? > ImportError: No module named Numeric have you installed the Numeric library? see the NLTK download page for details: http://nltk.sourceforg

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

2004-12-22 Thread abkhd
From: "" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python Subject: Re: Problem with msvcrt60 vs. msvcr71 vs. strdup/free Date: Wed, 22 Dec 2004 11:07:02 -0800 Gerhard Haering wrote: > Hello, > > I used to build Python extension modules with mingw. Now, Python has > switched to the MSVCR71 runtime

Re: cmp of multiple attributes

2004-12-22 Thread Alex Martelli
Roy Smith <[EMAIL PROTECTED]> wrote: > >Roy Smith wrote: > >> def __cmp__ (self, other): > >># I wish there was a less verbose way to do this! > >> if self.block < other.block: > >> return -1 > >> if self.block > other.block: > >> return 1 > >>

ANN: generateDS.py 8a available

2004-12-22 Thread Dave Kuhlman
generateDS.py 1.8a has been released. If you try it and have suggestions, comments, or bug reports, please send them my way. Where to find generateDS.py === You can find generateDS.py here: http://www.rexx.com/~dkuhlman/generateDS.html http://www.rexx.com/~dkuhl

Re: cmp of multiple attributes

2004-12-22 Thread Steven Bethard
Alex Martelli wrote: Comparisons of tuples, lists, etc, are *lexicographical*: the first items are compared; iff they're equal, then the second items, and so forth. IOW, exactly what you want in this case. Just to check my understanding, this means that: cmp(a0, b0) or cmp(a1, b1) or ... or cm

Re: Why are tuples immutable?

2004-12-22 Thread Alex Martelli
Jeff Shannon <[EMAIL PROTECTED]> wrote: ... > hashes) is that, for a well-behaved hash function, then A == B should > imply that hash(A) == hash(B). (The reverse is *not* true, however -- > hash(A) == hash(B) does not necessarily say anything about whether A == B.) > > If that is a correct con

Re: cmp of multiple attributes

2004-12-22 Thread Alex Martelli
Steven Bethard <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Comparisons of tuples, lists, etc, are *lexicographical*: the first > > items are compared; iff they're equal, then the second items, and so > > forth. IOW, exactly what you want in this case. > > Just to check my understanding

list IndexError

2004-12-22 Thread Ishwor
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 this a good or

Re: word to digit module

2004-12-22 Thread Scott David Daniels
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()] . stack = [0] . for num in numbers: . if num == -1: . raise ValueError("Invalid string '%s'" % (s,)

Re: Easy "here documents" ??

2004-12-22 Thread Jim Hill
Fredrik Lundh wrote: >Jim Hill wrote: > >> I'm trying to write a script that writes a script for a rather specialized >> task. I know that seems weird, but the original version was written in >> Korn shell and most of my team are familiar with the way it does things >> even though they don't read

Re: list IndexError

2004-12-22 Thread Fredrik Lundh
"Ishwor" <[EMAIL PROTECTED]> 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 w

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

<    1   2   3   >