Re: Merging two dictionaries

2010-08-02 Thread Gary Herron
On 08/01/2010 11:11 PM, Douglas Garstang wrote: On Sun, Aug 1, 2010 at 10:58 PM, Gary Herron wrote: On 08/01/2010 10:09 PM, Douglas Garstang wrote: Anyone, I have the two dictionaries below. How can I merge them, such that: 1. The cluster dictionary contains the additional elements

Re: Merging two dictionaries

2010-08-02 Thread Douglas Garstang
On Sun, Aug 1, 2010 at 11:57 PM, Gary Herron wrote: > On 08/01/2010 11:11 PM, Douglas Garstang wrote: >> >> On Sun, Aug 1, 2010 at 10:58 PM, Gary Herron >>  wrote: >> >>> >>> On 08/01/2010 10:09 PM, Douglas Garstang wrote: >>> Anyone, I have the two dictionaries below. How can

Re: Merging two dictionaries

2010-08-02 Thread Chris Rebert
On Mon, Aug 2, 2010 at 12:06 AM, Douglas Garstang wrote: > Actually, I had issues with trying recurse through the structures in > tandem too. This didn't work: > > for a,b,c,d in ( cluster.iteritems(), default.iteritems() ): >    ... do something ... > > It returns an unpack error. Well, yeah. Th

Re: Merging two dictionaries

2010-08-02 Thread Paul Rubin
Douglas Garstang writes: > default = {... > 'data_sources': { ... > cluster = {... > 'data_source': { ... Did you want both of those to say the same thing instead of one of them being 'data_source' and the other 'data_sources' ? If yes, then the following works fo

Re: How to catch windows shutdown/reboot message

2010-08-02 Thread Tim Golden
On 02/08/2010 02:17, rechardchen wrote: I'm writing a python script which runs as a windowsxp service. The problem is how to catch the windows shutdown/reboot message and do some cleaning job when system is going down? The atexit module and signal module on windows dont seems to work. I guess th

Re: Problem with Elementtree and XMLSchem instance type

2010-08-02 Thread NewBlue
> "Lawrence" == Lawrence D'Oliveiro > writes: Lawrence> In message Lawrence> , Lawrence> Roland Lawrence> Hedberg wrote: > And there is the problem, I've lost the coupling between the prefix >> 'fed' and the namespace >> "http://docs.oasis-open.org/wsfed/federati

Re: Merging two dictionaries

2010-08-02 Thread Peter Otten
Douglas Garstang wrote: > I have the two dictionaries below. How can I merge them, such that: > > 1. The cluster dictionary contains the additional elements from the > default dictionary. > 2. Nothing is removed from the cluster dictionary. def inplace_merge(default, cluster): assert isinsta

Re: How to capture all the environment variables from shell?

2010-08-02 Thread Thorsten Kampe
* Tim Chase (Mon, 26 Jul 2010 21:42:24 -0500) > On 07/26/10 21:26, Steven W. Orr wrote: > > Please! Never export anything from your .bashrc unless you > > really know what you're doing. Almost all exports should be > > done in your .bash_profile > > Could you elaborate on your reasoning why (or wh

Re: Access stdout from external program.

2010-08-02 Thread Jean-Michel Pichavant
Paul Lemelle wrote: Hi JM, My last dumb question: When I try to run the below script as an executable, I get the following error: ptt...@ptttestvm:~$ ./argv.py 4 import: unable to open X server `/tmp/launch-c8feFG/org.x:0' @ import.c/ImportImageCommand/361. ./argv.py: line 8: syntax error n

Capturing running Application

2010-08-02 Thread S.Selvam
Hi all, I am using python 2.6(running ubuntu 9.10 ). I want to display the amount of time spent( by an user) among all the running applications like Gedit, Firefox, GIMP and display the result graphically. For eg: Firefox: 60% Gedit:25% Terminal:15% I think, i need to capture the currently f

Re: Why is python not written in C++ ?

2010-08-02 Thread Tim Wintle
On Sun, 2010-08-01 at 20:01 -0400, Terry Reedy wrote: > Not every C programmer knows or wants to learn C++. I think Terry is the only person that's mentioned this - but I'd like to give extra support to it - I for one prefer C to C++ (as someone that writes quite a lot of C extension modules). An

Re: The untimely dimise of a weak-reference

2010-08-02 Thread Bruno Desthuilliers
Gregory Ewing a écrit : (snip) import weakref class weakmethod(object): def __init__(self, bm): self.ref = weakref.ref(bm.im_self) self.func = bm.im_func def __call__(self, *args, **kwds): obj = self.ref() if obj is None: raise ValueError("Calling dead weak method")

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Jean-Michel Pichavant
Paul Rubin wrote: Michele Simionato writes: I am actually more radical than that. From http://www.artima.com/weblogs/viewpost.jsp?thread=237121: In this series I have argued that super is tricky; I think nobody can... When I look at that URL, I see a Java stack dump: java.lang.Runt

Re: Trying to set a cookie within a python script

2010-08-02 Thread Steven D'Aprano
On Sun, 01 Aug 2010 23:39:34 -0700, Νίκος wrote: > If you just click in my web page to see the script run in action due to > the cgitb module i use it will provide you both the source code that the > error appears and the error as well. > > All you have to do is click here: > http://www.webville.

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Steven D'Aprano
On Sun, 01 Aug 2010 23:15:11 -0700, Michele Simionato wrote: > On Jul 31, 5:08 am, Steven D'Aprano cybersource.com.au> wrote: >> I have read Michelle Simionato's articles on super in Python. > > One "l" please! I am a man! ;-) My apologies. You'd think I would know the difference between Michel

Re: Normalizing A Vector

2010-08-02 Thread Bartc
"Alain Ketterlin" wrote in message news:877hkdhyl5@dpt-info.u-strasbg.fr... > Lawrence D'Oliveiro writes: > >> Say a vector V is a tuple of 3 numbers, not all zero. You want to >> normalize >> it (scale all components by the same factor) so its magnitude is 1. >> >> The usual way is somethi

Re: Normalizing A Vector

2010-08-02 Thread Alain Ketterlin
"Bartc" writes: >> def norm(V): >>L = math.sqrt( sum( [x**2 for x in V] ) ) >>return [ x/L for x in V ] > > There's a cost involved in using those fancy constructions. Sure. The above has three loops that take some time. > I found the following to be about twice as fast, when vectors ar

python3: signal.signal/singal.alarm not working as expected

2010-08-02 Thread Alan
Hi there, I have this example code to illustrate a problem I am having with python3. It works fine with python 2.6 and 2.7 but does not with python 3.1. Please, can someone tell me why or how to fix this example? from __future__ import print_function import os, subprocess, signal def signal_ha

Re: Normalizing A Vector

2010-08-02 Thread Bartc
"Alain Ketterlin" wrote in message news:87fwyxgvuv@dpt-info.u-strasbg.fr... > "Bartc" writes: >> def norm3d(v): >> L = math.sqrt((v[0]*v[0]+v[1]*v[1]+v[2]*v[2])) >> return (v[0]/L,v[1]/L,v[2]/L) >> >> (Strangely, changing those divides to multiplies made it slower.) > > You mean by

Re: beginner python GUI question

2010-08-02 Thread Chris Hare
On Aug 1, 2010, at 8:33 PM, rechardchen wrote: > 于 2010-8-2 6:15, Chris Hare 写道: >> I hope I can explain this correctly. >> >> I have a GUI, which is already being processed by a mainloop. I want to be >> able to open a second window so the user can interact with specific >> information in th

run subprocesses in parallel

2010-08-02 Thread Santiago Caracol
Hello, I want to run several subprocesses. Like so: p1 = Popen("mycmd1" + " myarg", shell=True) p2 = Popen("mycmd2" + " myarg", shell=True) ... pn = Popen("mycmdn" + " myarg", shell=True) What would be the most elegant and secure way to run all n subprocesses in parallel? Santiago -- http://ma

Re: run subprocesses in parallel

2010-08-02 Thread Christian Heimes
> I want to run several subprocesses. Like so: > > p1 = Popen("mycmd1" + " myarg", shell=True) > p2 = Popen("mycmd2" + " myarg", shell=True) > > pn = Popen("mycmdn" + " myarg", shell=True) > > What would be the most elegant and secure way to run all n > subprocesses in parallel? They alread

Re: beginner python GUI question

2010-08-02 Thread Peter Otten
Chris Hare wrote: >>> root = Tk() >>> root.title = "test" > I should think it would work, but I don't understand why it doesn't. Try root.title("test") title() is a method that you are hiding with your attribute leading to problems later on. By the way, what kind of documentation are you usi

Re: How to catch windows shutdown/reboot message

2010-08-02 Thread rechardchen
于 2010-8-2 16:00, Tim Golden 写道: On 02/08/2010 02:17, rechardchen wrote: I'm writing a python script which runs as a windowsxp service. The problem is how to catch the windows shutdown/reboot message and do some cleaning job when system is going down? The atexit module and signal module on wind

Re: Trying to set a cookie within a python script

2010-08-02 Thread Νίκος
Steven, First of all thank you for your response. I cant beleive i neglected to import the time module! The only reason that i asked you guys to follow the link was for you to see the actualt coding and error report as python produces it by itself with all the relative characteristics. Of course

Re: beginner python GUI question

2010-08-02 Thread Chris Hare
On Aug 2, 2010, at 7:25 AM, Peter Otten wrote: > Chris Hare wrote: > root = Tk() root.title = "test" > >> I should think it would work, but I don't understand why it doesn't. > > Try > > root.title("test") > > title() is a method that you are hiding with your attribute leading to

Re: Mechanize - save to XML or CSV

2010-08-02 Thread Simon Brunning
On 2 August 2010 14:13, flebber wrote: > HI guys and gals this is probably a simple question but I can't find > the answer directly in the docs for python mechanize. > > http://pypi.python.org/pypi/mechanize/ > > Is it possible to retrieve and save a web page data as xml or a csv > file? Sure, bu

Re: Why is python not written in C++ ?

2010-08-02 Thread Grant Edwards
On 2010-08-02, Christian Heimes wrote: > In your opinion what would Python gain from a C++ implementation? Greater buzzword-compliance -- an important characteristic highly prized by Human-Resources poeple and mid-level managers here in the US. ;) -- Grant -- http://mail.python.org/mailman/

AMY JACKSON HOT PICTURES including upcoming movies, biography,

2010-08-02 Thread amyjack1
AMY JACKSON HOT PICTURES including upcoming movies, biography, http://amyjacksons.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is there no platform independent way of clearing a terminal?

2010-08-02 Thread Mark Lawrence
On 01/08/2010 12:10, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: Personally I find double clicking on an msi

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Mark Lawrence
On 02/08/2010 10:23, Jean-Michel Pichavant wrote: Paul Rubin wrote: Michele Simionato writes: I am actually more radical than that. From http://www.artima.com/weblogs/viewpost.jsp?thread=237121: In this series I have argued that super is tricky; I think nobody can... When I look at that URL,

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Mark Lawrence
On 02/08/2010 07:15, Michele Simionato wrote: On Jul 31, 5:08 am, Steven D'Aprano wrote: I have read Michelle Simionato's articles on super in Python. One "l" please! I am a man! ;-) Please prove it, get your bits out!!! :) M. Simionato -- http://mail.python.org/mailman/li

Re: Why is there no platform independent way of clearing a terminal?

2010-08-02 Thread Benjamin Kaplan
On Mon, Aug 2, 2010 at 8:21 AM, Mark Lawrence wrote: > On 01/08/2010 12:10, Lawrence D'Oliveiro wrote: > >> In message, Mark >> Lawrence wrote: >> >> On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: >>> >>> In message, Mark Lawrence wrote: On 01/08/2010 07:50, Lawrence D'Oliveiro

THANKS GOD! I GOT $2000 FROM PAYPAL....

2010-08-02 Thread paypal cash
THANKS GOD! I GOT $2000 FROM PAYPAL At http://ukcollegegirls.co.cc I have hidden the PayPal Form link in an image. in that website On Top Side Above search box , click on image and enter your PayPal id And Your name. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-02 Thread David Cournapeau
On Mon, Aug 2, 2010 at 10:20 AM, Christian Heimes wrote: > > In your opinion what would Python gain from a C++ implementation? The elusive advantages of "OO" in C++ are relatively minor compared to RIIA which would make reference counting much easier to deal with. But even that is not a strong e

Re: Why is python not written in C++ ?

2010-08-02 Thread Thomas Jollans
On 08/02/2010 04:42 PM, Grant Edwards wrote: > On 2010-08-02, Christian Heimes wrote: > >> In your opinion what would Python gain from a C++ implementation? > > Greater buzzword-compliance -- an important characteristic highly > prized by Human-Resources poeple and mid-level managers here in the

Re: Why is there no platform independent way of clearing a terminal?

2010-08-02 Thread Mark Lawrence
On 02/08/2010 16:41, Benjamin Kaplan wrote: On Mon, Aug 2, 2010 at 8:21 AM, Mark Lawrencewrote: On 01/08/2010 12:10, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: In message, Mark Lawrence wrote: On 01/08/2010 07:50, Law

Re: Merging two dictionaries

2010-08-02 Thread Douglas Garstang
On Mon, Aug 2, 2010 at 12:47 AM, Paul Rubin wrote: > Douglas Garstang writes: >> default = {... >>                 'data_sources': { ... >> cluster = {... >>                 'data_source': { ... > > Did you want both of those to say the same thing instead of one > of them being 'data_source' and

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Ethan Furman
Steven D'Aprano wrote: On Sat, 31 Jul 2010 13:29:25 +, Brian Victor wrote: Steven D'Aprano wrote: On Sat, 31 Jul 2010 14:25:39 +1200, Gregory Ewing wrote: Steven D'Aprano wrote: A / \ C B \ / D / \ E F Yes, a super call might jog left from C to B

Re: Merging two dictionaries

2010-08-02 Thread Peter Otten
Douglas Garstang wrote: > On Mon, Aug 2, 2010 at 12:47 AM, Paul Rubin wrote: >> If yes, then the following works for me: >> >>def merge(cluster, default): >># destructively merge default into cluster >>for k,v in cluster.iteritems(): >>if k in default and type(v)

Re: Why is there no platform independent way of clearing a terminal?

2010-08-02 Thread David Robinow
On Mon, Aug 2, 2010 at 11:41 AM, Benjamin Kaplan wrote: >... > So these are the packages needed just to run Python in Ubuntu. It doesn't > include the packages required for the kernel, the desktop environment, the > window manager, the terminal, and whatever else you want running. In my > fairly c

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread donn
On 02/08/2010 17:35, Mark Lawrence wrote: aka the colon. :) Ha. This is a case of the colon being the appendix! \d -- http://mail.python.org/mailman/listinfo/python-list

Re: Merging two dictionaries

2010-08-02 Thread Douglas Garstang
On Mon, Aug 2, 2010 at 1:09 AM, Peter Otten <__pete...@web.de> wrote: > Douglas Garstang wrote: > >> I have the two dictionaries below. How can I merge them, such that: >> >> 1. The cluster dictionary contains the additional elements from the >> default dictionary. >> 2. Nothing is removed from the

Re: run subprocesses in parallel

2010-08-02 Thread Nobody
On Mon, 02 Aug 2010 14:21:38 +0200, Christian Heimes wrote: > You might want to drop shell=True and use > a list as arguments instead. The two issues (whether "shell" is True/False and whether the command is a list or string) are orthogonal. You should always use a list for the command, unless y

Re: Accumulate function in python

2010-08-02 Thread Aahz
In article <7xpqyjgvjm@ruckus.brouhaha.com>, Paul Rubin wrote: > >I think Peter Otten's solution involving a generator is the one most in >the current Python spirit. It's cleaner (for my tastes) than the ones >that use things like list.append. Agreed -- Aahz (a...@pythoncraft.com)

Re: Merging two dictionaries

2010-08-02 Thread Paul Rubin
Douglas Garstang writes: > where line 42 is 'assert type(default(k))==dict', and the inputs are: Woops, cut and paste error. default(k) should say default[k]. Or you could remove the assertion altogether. -- http://mail.python.org/mailman/listinfo/python-list

Behavior of re.split on empty strings is unexpected

2010-08-02 Thread John Nagle
The regular expression "split" behaves slightly differently than string split: >>> import re >>> kresplit = re.compile(r'[^\w\&]+',re.UNICODE) >>> kresplit2.split(" HELLOTHERE ") ['', 'HELLO', 'THERE', ''] >>> kresplit2.split("VERISIGN INC.") ['VERISIGN', 'INC', ''] I'd thought that

constructing and using large lexicon in a program

2010-08-02 Thread Majdi Sawalha
Dear List members, I am developing a morphological analyzer that depends on a large lexicon. i construct a Lexicon class that reades a text file and construct a dictionary of the lexicon entries.  the other class will use the lexicon class to chech if the word is found in the lexicon. the probl

Re: constructing and using large lexicon in a program

2010-08-02 Thread Michael Torrie
On 08/02/2010 11:46 AM, Majdi Sawalha wrote: > I am developing a morphological analyzer that depends on a large lexicon. i > construct a Lexicon class that reades a text file and construct a dictionary > of > the lexicon entries. > the other class will use the lexicon class to chech if the word

Re: Behavior of re.split on empty strings is unexpected

2010-08-02 Thread MRAB
John Nagle wrote: The regular expression "split" behaves slightly differently than string split: >>> import re >>> kresplit = re.compile(r'[^\w\&]+',re.UNICODE) >>> kresplit2.split(" HELLOTHERE ") ['', 'HELLO', 'THERE', ''] >>> kresplit2.split("VERISIGN INC.") ['VERISIGN', 'IN

Re: Behavior of re.split on empty strings is unexpected

2010-08-02 Thread Peter Otten
John Nagle wrote: > The regular string split operation doesn't yield empty strings: > > >>> " HELLO THERE ".split() > ['HELLO', 'THERE'] Note that invocation without separator argument (or None as the separator) is special in that respect: >>> " hello there ".split(" ") ['', 'hello', 'ther

Re: Why is there no platform independent way of clearing a terminal?

2010-08-02 Thread Benjamin Kaplan
On Mon, Aug 2, 2010 at 9:51 AM, David Robinow wrote: > On Mon, Aug 2, 2010 at 11:41 AM, Benjamin Kaplan > wrote: > >... > > So these are the packages needed just to run Python in Ubuntu. It doesn't > > include the packages required for the kernel, the desktop environment, > the > > window manage

namespaces, scoping and variables

2010-08-02 Thread Chris Hare
I am having a problem getting around this variable namespace thing. Consider these code bits File a.py from Tkinter import * import a1 def doAgain(): x = a1.Net() x.show("Again!") root = Tk() root.title("test") f = Frame(root,bg="Yellow") l = Button(root,text="window 1",command=

Re: Behavior of re.split on empty strings is unexpected

2010-08-02 Thread John Nagle
On 8/2/2010 11:02 AM, MRAB wrote: John Nagle wrote: The regular expression "split" behaves slightly differently than string split: occurrences of pattern", which is not too helpful. It's the plain str.split() which is unusual in that: 1. it splits on sequences of whitespace instead of one p

Re: namespaces, scoping and variables

2010-08-02 Thread Thomas Jollans
On 08/02/2010 09:33 PM, Chris Hare wrote: > I am having a problem getting around this variable namespace thing. > > Consider these code bits > > File a.py > from Tkinter import * > import a1 > > def doAgain(): > x = a1.Net() > x.show("Again!") > > root = Tk() > root.title("test") >

Re: Behavior of re.split on empty strings is unexpected

2010-08-02 Thread Thomas Jollans
On 08/02/2010 09:41 PM, John Nagle wrote: > On 8/2/2010 11:02 AM, MRAB wrote: >> John Nagle wrote: >>> The regular expression "split" behaves slightly differently than >>> string split: > occurrences of pattern", which is not too helpful. >>> >> It's the plain str.split() which is unusual in that:

Re: namespaces, scoping and variables

2010-08-02 Thread Dave Angel
Chris Hare wrote: I am having a problem getting around this variable namespace thing. Consider these code bits File a.py from Tkinter import * import a1 def doAgain(): x =1.Net() x.show("Again!") root =k() root.title("test") f =rame(root,bg="Yellow") l =utton(root,text="window

Re: Why is python not written in C++ ?

2010-08-02 Thread Mithrandir
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/01/2010 07:34 PM, Albert Hopkins wrote: > On Mon, 2010-08-02 at 01:08 +0200, candide wrote: >> Python is an object oriented langage (OOL). The Python main >> implementation is written in pure and "old" C90. Is it for historical >> reasons? >> >

Re: namespaces, scoping and variables

2010-08-02 Thread MRAB
Chris Hare wrote: I am having a problem getting around this variable namespace thing. Consider these code bits File a.py from Tkinter import * import a1 def doAgain(): x = a1.Net() x.show("Again!") root = Tk() root.title("test") f = Frame(root,bg="Yellow") l = Button(root,text

Re: namespaces, scoping and variables

2010-08-02 Thread Ethan Furman
Chris Hare wrote: I am having a problem getting around this variable namespace thing. Consider these code bits File a.py from Tkinter import * import a1 def doAgain(): x = a1.Net() x.show("Again!") root = Tk() root.title("test") f = Frame(root,bg="Yellow") l = Button(root,text

Re: namespaces, scoping and variables

2010-08-02 Thread Chris Hare
Thanks to everyone for answering my question. I think its clear now. I'll just go the "stuff 'em in a module and import that" route. Chris On Aug 2, 2010, at 3:03 PM, MRAB wrote: > Chris Hare wrote: >> I am having a problem getting around this variable namespace thing. >> Consider these code

Re: Trying to set a cookie within a python script

2010-08-02 Thread Νίκος
Hello, any ideas?! -- http://mail.python.org/mailman/listinfo/python-list

Re: how best to clear objects from a frame

2010-08-02 Thread Chris Hare
On Aug 1, 2010, at 10:13 PM, rantingrick wrote: > On Aug 1, 7:12 pm, Chris Hare wrote: >> Here is the situation: >> >> I have a window with a bunch of widgets in it. I want to clear the objects >> in a given frame and recreate them to update them. > > You need to check out the "w.update" a

Re: namespaces, scoping and variables

2010-08-02 Thread rantingrick
On Aug 2, 3:12 pm, Chris Hare wrote: > Thanks to everyone for answering my question.  I think its clear now.  I'll > just go the "stuff 'em in a module and import that" route. Chris, first of all i want you to know that this message is not meant to offend but it may offend you -- hopefully your

Re: Trying to set a cookie within a python script

2010-08-02 Thread Thomas Jollans
On 08/02/2010 04:20 AM, Νίκος wrote: > Also my greek print appear in funny encoding although i do use # -*- > coding: utf-8 -*- That's because you never told the web browser which encoding you're using. Content-Type: text/html; charset=UTF-8 -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to set a cookie within a python script

2010-08-02 Thread Thomas Jollans
On 08/02/2010 10:13 PM, Νίκος wrote: > Hello, any ideas?! That's no way to treat a friendly volunteer mailing list like this one! On 08/02/2010 02:32 PM, Νίκος wrote: > As for the encoding Notepad++, which is what i use for an editor say > its UTF-8 without BOM. > > Isn't this what i'm supposed

Re: let optionparse.Optionparser ignore unknown command line switches.

2010-08-02 Thread News123
On 08/01/2010 07:53 PM, Jon Clements wrote: > On 1 Aug, 16:43, News123 wrote: >> On 08/01/2010 05:34 PM, Steven W. Orr wrote: >> >> >> >>> On 08/01/10 07:27, quoth News123: On 08/01/2010 01:08 PM, News123 wrote: > I wondered, whether there's a simple/standard way to let > the Optionpa

Re: Behavior of re.split on empty strings is unexpected

2010-08-02 Thread John Nagle
On 8/2/2010 12:52 PM, Thomas Jollans wrote: On 08/02/2010 09:41 PM, John Nagle wrote: On 8/2/2010 11:02 AM, MRAB wrote: John Nagle wrote: The regular expression "split" behaves slightly differently than string split: occurrences of pattern", which is not too helpful. It's the plain str.spl

checking that process binds a port, fuser functionality

2010-08-02 Thread Zdenek Maxa
Hello, I need to start a process (using subprocess.Popen()) and wait until the new process either fails or successfully binds a specified port. The fuser command seems to be indented exactly for this purpose. Could anyone please provided a hint to a handy Python library to do this or would the adv

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-08-02 Thread Mark Lawrence
On 02/08/2010 17:53, donn wrote: On 02/08/2010 17:35, Mark Lawrence wrote: aka the colon. :) Ha. This is a case of the colon being the appendix! \d Is there a better newsgroup in the world than c.l.py? No! Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-l

Re: Behavior of re.split on empty strings is unexpected

2010-08-02 Thread Benjamin Kaplan
On Mon, Aug 2, 2010 at 2:22 PM, John Nagle wrote: > On 8/2/2010 12:52 PM, Thomas Jollans wrote: > >> On 08/02/2010 09:41 PM, John Nagle wrote: >> >>> On 8/2/2010 11:02 AM, MRAB wrote: >>> John Nagle wrote: > The regular expression "split" behaves slightly differently than > stri

Re: Why is there no platform independent way of clearing a terminal?

2010-08-02 Thread Mark Lawrence
On 02/08/2010 19:14, Benjamin Kaplan wrote: On Mon, Aug 2, 2010 at 9:51 AM, David Robinow wrote: On Mon, Aug 2, 2010 at 11:41 AM, Benjamin Kaplan wrote: ... So these are the packages needed just to run Python in Ubuntu. It doesn't include the packages required for the kernel, the desktop en

Re: Why is python not written in C++ ?

2010-08-02 Thread Mark Lawrence
On 02/08/2010 00:08, candide wrote: Python is an object oriented langage (OOL). The Python main implementation is written in pure and "old" C90. Is it for historical reasons? C is not an OOL and C++ strongly is. I wonder if it wouldn't be more suitable to implement an OOL with another one. Has

Re: how best to clear objects from a frame

2010-08-02 Thread Mark Lawrence
On 02/08/2010 04:13, rantingrick wrote: On Aug 1, 7:12 pm, Chris Hare wrote: Here is the situation: I have a window with a bunch of widgets in it. I want to clear the objects in a given frame and recreate them to update them. You need to check out the "w.update" and "w.update_idletasks" me

Re: Why is python not written in C++ ?

2010-08-02 Thread Peter
On Aug 3, 7:42 am, Mark Lawrence wrote: > On 02/08/2010 00:08, candide wrote: > > I can't understand why any serious programmer mentions C++. As soon as I > read it, I have to rush either to the kitchen to find a bowl to throw up > in, or head for the toilet so I can talk to the great white telep

Re: Why is python not written in C++ ?

2010-08-02 Thread Michael Torrie
On 08/02/2010 03:42 PM, Mark Lawrence wrote: > I can't understand why any serious programmer mentions C++. As soon as I > read it, I have to rush either to the kitchen to find a bowl to throw up > in, or head for the toilet so I can talk to the great white telephone. Sometimes, C++ is just the r

Re: Behavior of re.split on empty strings is unexpected

2010-08-02 Thread Thomas Jollans
On 08/02/2010 11:22 PM, John Nagle wrote: >> [ s in rexp.split(long_s) if s ] > >Of course I can discard the blank strings afterward, but > is there some way to do it in the "split" operation? If > not, then the default case for "split()" is too non-standard. > >(Also, "if s" won't work;

Trying to run Python 2.7 on Windows 7 and any suggestions on books/websites for "dummies guide to python" type learning

2010-08-02 Thread ben owen
Hi everyone, I'm new to this and was needing help with trying to learn/work with Python 2.7 on my computer. I'm running Windows 7 and trying to learn python programming from an older book from 1999 by Mark Lutz and David Ascher my boss gave me, and for some reason none of my script/modules for

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 2 Aug, 01:08, candide wrote: > Has it ever been planned to rewrite in C++ the historical implementation > (of course in an object oriented design) ? OO programming is possible in C. Just take a look at GNOME and GTK. Perl is written in C++. That is not enough to make me want to use it ;) T

Re: Why is python not written in C++ ?

2010-08-02 Thread Paul Rubin
Michael Torrie writes: > Sometimes, C++ is just the right tool for the job, despite all its > warts C++'s object semantics (guaranteed destruction, scoping, > etc) can sometimes work very well when you need the speed of a > compiled language, but don't want to be quite as low-level as C. > >

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 2 Aug, 05:04, Tomasz Rola wrote: > And one should not forget about performance. C++ was for a long time > behind C, and even now some parts (like iostreams) should be avoided in > fast code. For fast I/O one must use platform specific APIs, such as Windows' i/o completion ports and memory map

Re: Trying to run Python 2.7 on Windows 7 and any suggestions on books/websites for "dummies guide to python" type learning

2010-08-02 Thread James Mills
On Tue, Aug 3, 2010 at 8:07 AM, ben owen wrote: > Hi everyone, I'm new to this and was needing help with trying to learn/work > with Python 2.7 on my computer. I'm running Windows 7 and trying to learn > python programming from an older book from 1999 by Mark Lutz and David > Ascher my boss gave m

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 3 Aug, 00:27, Paul Rubin wrote: > Certain folks in the functional-programming community consider OO to be > a 1980's or 1990's approach that didn't work out, and that what it was > really trying to supply was polymorphism.  C++ programs these days > apparently tend to use template-based generi

Re: Why is python not written in C++ ?

2010-08-02 Thread Aahz
In article , Peter wrote: >On Aug 3, 7:42=A0am, Mark Lawrence wrote: >> On 02/08/2010 00:08, candide wrote: >> >> I can't understand why any serious programmer mentions C++. As soon as I >> read it, I have to rush either to the kitchen to find a bowl to throw up >> in, or head for the toilet so

Re: Why is python not written in C++ ?

2010-08-02 Thread Martin Gregorie
On Mon, 02 Aug 2010 15:54:52 -0700, sturlamolden wrote: > On 3 Aug, 00:27, Paul Rubin wrote: > >> Certain folks in the functional-programming community consider OO to be >> a 1980's or 1990's approach that didn't work out, and that what it was >> really trying to supply was polymorphism.  C++ pr

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 3 Aug, 01:14, Martin Gregorie wrote: > Bottom line: All this would still have happened regardless of the > programming language used. I am quite sure C and Fortran makes it unlikely for an unhandled exception to trigger the autodestruct sequence. But it's nice to know when flying that modern

Re: Why is python not written in C++ ?

2010-08-02 Thread Mark Lawrence
On 03/08/2010 00:03, Aahz wrote: In article, Peter wrote: On Aug 3, 7:42=A0am, Mark Lawrence wrote: On 02/08/2010 00:08, candide wrote: I can't understand why any serious programmer mentions C++. As soon as I read it, I have to rush either to the kitchen to find a bowl to throw up in, or hea

Re: Why is python not written in C++ ?

2010-08-02 Thread Mark Lawrence
On 03/08/2010 00:14, Martin Gregorie wrote: On Mon, 02 Aug 2010 15:54:52 -0700, sturlamolden wrote: On 3 Aug, 00:27, Paul Rubin wrote: Certain folks in the functional-programming community consider OO to be a 1980's or 1990's approach that didn't work out, and that what it was really trying

Package management (was: Why is there no platform independent way of clearing a terminal?)

2010-08-02 Thread Ben Finney
Mark Lawrence writes: > How does any user or an admin cope with 500 packages? Operating systems with good package management come with tools that help the administrator do this job easily. Also, operating systems with good package management encourage the small-pieces-loosely-joined philosophy

Re: Why is there no platform independent way of clearing a terminal?

2010-08-02 Thread MRAB
Mark Lawrence wrote: On 02/08/2010 19:14, Benjamin Kaplan wrote: On Mon, Aug 2, 2010 at 9:51 AM, David Robinow wrote: On Mon, Aug 2, 2010 at 11:41 AM, Benjamin Kaplan wrote: ... So these are the packages needed just to run Python in Ubuntu. It doesn't include the packages required for th

Re: Why is python not written in C++ ?

2010-08-02 Thread sturlamolden
On 3 Aug, 01:37, Mark Lawrence wrote: > A bug is a bug is a bug? According to Grace Hopper, a bug might be a moth, in which case the best debugger is a pair of forceps. -- http://mail.python.org/mailman/listinfo/python-list

simple integer subclass

2010-08-02 Thread Andreas Pfrengle
I'm trying to define a subclass of int called int1. An int1-object shall behave exactly like an int-object, with the only difference that the displayed value shall be value + 1 (it will be used to display array indices starting at 1 instead of 0). Right now I have: class int1(int): def __str__

Re: Why is python not written in C++ ?

2010-08-02 Thread Christian Heimes
Am 03.08.2010 01:03, schrieb Aahz: > http://www.netfunny.com/rhf/jokes/98/May/stroustrup.html I don't understand why the URL contains the word "joke". Every word is true. Hell yeah! :) Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-02 Thread Carey Tilden
On Mon, Aug 2, 2010 at 3:18 PM, sturlamolden wrote: > > Perl is written in C++. That is not enough to make me want to use > it ;) I realize this was meant to be funny, but it's not true, and detracts from the point you were trying to make. Maybe skip the pointless jabs at Perl and stick to thing

calling a class method from a menu in a different class

2010-08-02 Thread Chris Hare
What I am trying to do is call a class function from a menu, for example displaySubMenu.add_radiobutton(label="Medium", variable=radarPanelSize, command=radarWidgets.refresh) class radarWidgets: def __init__(self,root): self.window = root

Re: Why is python not written in C++ ?

2010-08-02 Thread Peter
On Aug 3, 8:27 am, Paul Rubin wrote: ... > > Certain folks in the functional-programming community consider OO to be > a 1980's or 1990's approach that didn't work out, and that what it was > really trying to supply was polymorphism.  C++ programs these days > apparently tend to use template-based

simple (I hope!) problem

2010-08-02 Thread samwyse
I'm writing for the Google app engine and have stubbed my toe yet again on a simple obstacle. Non-trivial app engines programs require the import of several modules that aren't normally in my PYTHONPATH. I'd like to be able to test my code outside of the app engine framework. I've tried several s

Re: simple integer subclass

2010-08-02 Thread samwyse
On Aug 2, 6:52 pm, Andreas Pfrengle wrote: > I'm trying to define a subclass of int called int1. An int1-object > shall behave exactly like an int-object, with the only difference that > the displayed value shall be value + 1 (it will be used to display > array indices starting at 1 instead of 0).

Re: Why is python not written in C++ ?

2010-08-02 Thread Paul Rubin
sturlamolden writes: > It is annyingly verbose, reminds me of Pascal (I hate the looks of > it), and is rumoured to produce slow bloatware. The earliest Ada compilers were terrible, but they are about like C compilers now, so the output code is ok (see Alioth shootout for example). I agree abou

Re: Why is python not written in C++ ?

2010-08-02 Thread Roy Smith
In article <0ed1fb16-87cb-4fb9-85b2-08d876445...@q22g2000yqm.googlegroups.com>, sturlamolden wrote: > The typical examples revealing incompetence are use of > new[] instead of std::vector To be fair, there were usable C++ compilers before there were usable STL implementations. Thus, it shoul

  1   2   >