please, help with python 3.1

2010-08-02 Thread Alan
Hello List, Please, can someone at least try this code below in python 3 and report me back whether it works or not? Because for me this code works in python 2.6 but not with python 3.1. Thanks! from __future__ import print_function import os, subprocess, signal def signal_handler( signum, fram

Re: simple (I hope!) problem

2010-08-02 Thread Steven D'Aprano
On Mon, 02 Aug 2010 17:19:46 -0700, samwyse wrote: > Fortunately, I don't need the functionality of the object, I just want > something that won't generate an error when I use it. So, what is the > quickest way to to create such an object (replacing the 'pass' in my > first snippet). My solution

Re: Trying to set a cookie within a python script

2010-08-02 Thread Νίκος
>On 2 Αύγ, 23:57, Thomas Jollans wrote: > So: tripple-check that > >  * your file is >  * Python knows that >  * the web browser knows that Thank you! i used print ''' Content-Type: text/html; charset=UTF-8 / n''' and it worked. I'am still pretty confused about the encodings. Please tell me th

Re: sending a file chunk by chunk instead as a whole to a web server

2010-08-02 Thread Ryan Kelly
On Tue, 2010-08-03 at 10:45 +0530, Kushal Kumaran wrote: > On Mon, Aug 2, 2010 at 12:22 PM, Sanjeeb wrote: > > Hi, > > I have a web client which send a file to a server as multipart form > > data, the sending of data is from > > http://code.activestate.com/recipes/146306-http-client-to-post-using-

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

2010-08-02 Thread Michele Simionato
On Aug 1, 1:08 pm, News123 wrote: > I wondered, whether there's a simple/standard way to let > the Optionparser just ignore unknown command line switches. > > thanks in advance for any ideas I will plug in my own work on plac: http://pypi.python.org/pypi/plac Your problem would be solved as follo

Re: sending a file chunk by chunk instead as a whole to a web server

2010-08-02 Thread Kushal Kumaran
On Mon, Aug 2, 2010 at 12:22 PM, Sanjeeb wrote: > Hi, > I have a web client which send a file to a server as multipart form > data, the sending of data is from > http://code.activestate.com/recipes/146306-http-client-to-post-using-multipartform-data/. > > I dont want to open the whole file to memo

Re: sending a file chunk by chunk instead as a whole to a web server

2010-08-02 Thread Sanjeeb
On Aug 2, 11:52 am, Sanjeeb wrote: > Hi, > I have a web client which send a file to a server as multipart form > data, the sending of data is > fromhttp://code.activestate.com/recipes/146306-http-client-to-post-using- > > I dont want to open the whole file to memory(at cliend end) and then >

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

2010-08-02 Thread Mark Tolonen
"ben owen" wrote in message news:snt124-w51cdf963a687dd653cc804cc...@phx.gbl... 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

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

2010-08-02 Thread Aahz
In article <2b473423-0a22-4f4d-943f-31ea2d602...@z10g2000yqb.googlegroups.com>, sturlamolden wrote: > >And since this is comp.lang.python, I'll add in that this sometimes >applies to Python as well. Python, like C++, can have the call stack >rewinded by an exception. If we call some raw OS resour

Seeking help with urllib2 response reading

2010-08-02 Thread Hiral Shah
Hi All, I am facing problem reading response from urllib2 request. i.e. with read() method. I am trying to access XMLAPI using python. I am getting weird behavior from server, when reading response.Code for calling XMLAPI is as follows: headers = {'Content-type': 'application/x-www-form-urlenc

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

2010-08-02 Thread Aahz
In article , Roy Smith wrote: >In article , a...@pythoncraft.com (Aahz) >wrote: >> >> http://www.netfunny.com/rhf/jokes/98/May/stroustrup.html > >The same story has been floating around for eons, just with the names >changed. I saw one where Wirth was ostensibly making fun of the people >who

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

2010-08-02 Thread rantingrick
On Aug 2, 7:53 pm, samwyse wrote: > It's the same results; however many people don't like these results > because they feel that whitespace occupies a privileged role.  People > generally agree that a string of consecutive commas means missing > values, but a string of consecutive spaces just mea

Re: simple integer subclass

2010-08-02 Thread rantingrick
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: calling a class method from a menu in a different class

2010-08-02 Thread rantingrick
Chris, It looks as if you are calling a class object and not an instance object. However i cannot be for sure because you are using improper Python style. All classes should be capwords. But here again you have used camelcase for the class identifiers "radarWidgets" and "mainDisplay", which is ba

Re: default behavior

2010-08-02 Thread John Posner
On 7/31/2010 1:31 PM, John Posner wrote: Caveat -- there's another description of defaultdict here: http://docs.python.org/library/collections.html#collections.defaultdict ... and it's bogus. This other description claims that __missing__ is a method of defaultdict, not of dict. Following is

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

2010-08-02 Thread Roy Smith
In article <7d95c0d3-718d-4958-9364-263c833f1...@i24g2000yqa.googlegroups.com>, sturlamolden wrote: > On 3 Aug, 02:47, Roy Smith wrote: > > > This one I don't understand.  Yes, I get RAII, but surely there are > > valid reasons to allocate memory outside of constructors.  Containers > > which

paypal wholesale gucci shoes (paypal payment)

2010-08-02 Thread world-trade
paypal wholesale d&g shoes (paypal payment) ( http://www.24hours-buy.com/ ) paypal wholesale gucci shoes (paypal payment) ( http://www.24hours-buy.com/ ) paypal wholesale lv shoes (paypal payment) ( http://www.24hours-buy.com/ ) paypal wholesale NBA shoes (paypal payment) ( http://www.24hours-buy.c

Re: Normalizing A Vector

2010-08-02 Thread sturlamolden
On 30 Jul, 13:46, Lawrence D'Oliveiro wrote: > 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 something like this: > >     L = math.sqrt(V[0] * V[0] + V[1] * V[1] + V[2] * V[2])

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

2010-08-02 Thread sturlamolden
On 3 Aug, 04:03, sturlamolden wrote: > struct File { >     std::FILE *fid; >     File(const char *name) { >         // acquire resource in constructor >         fid = std::fopen(name); >         if (!fid) throw some_exception; >     } >     ~File() { >         // free resource in destructor >    

Re: constructing and using large lexicon in a program

2010-08-02 Thread Dan Stromberg
On Mon, Aug 2, 2010 at 10:46 AM, Majdi Sawalha wrote: > 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

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

2010-08-02 Thread sturlamolden
On 3 Aug, 02:47, Roy Smith wrote: > This one I don't understand.  Yes, I get RAII, but surely there are > valid reasons to allocate memory outside of constructors.  Containers > which resize themselves (such as std::vector) are one obvious example. That is because an exception might skip an arbi

Re: Normalizing A Vector

2010-08-02 Thread Lawrence D'Oliveiro
In message <6dw5o.72330$ds3.63...@hurricane>, Bartc wrote: > There's a cost involved in using those fancy constructions. Sure. But at the point that starts to matter, you have to ask yourself why you’re not rewriting the CPU-intensive part in C. -- http://mail.python.org/mailman/listinfo/python

Re: Problem with Elementtree and XMLSchem instance type

2010-08-02 Thread Lawrence D'Oliveiro
In message <6627204c-d0b1-456d-94bd-76d946ad2...@g6g2000pro.googlegroups.com>, Carl Banks wrote: > On Aug 1, 5:43 pm, Lawrence D'Oliveiro > wrote: > >> In message >> <96e47fd8-c939-48a2-9a2b-92afa720c...@k1g2000prl.googlegroups.com>, Carl >> Banks wrote: >> >>> My general feeling is that Element

Re: simple integer subclass

2010-08-02 Thread Carl Banks
On Aug 2, 4: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 Roy Smith
In article , a...@pythoncraft.com (Aahz) wrote: > http://www.netfunny.com/rhf/jokes/98/May/stroustrup.html The same story has been floating around for eons, just with the names changed. I saw one where Wirth was ostensibly making fun of the people who didn't understand that Pascal was all jus

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

2010-08-02 Thread samwyse
On Aug 2, 12:34 pm, John Nagle wrote: > The regular expression "split" behaves slightly differently than string > split: I'm going to argue that it's the string split that's behaving oddly. To see why, let's first look at some simple CSV values: cat,dog ,missing,,values, How many fields are on e

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1   2   >