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

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

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

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

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

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

<    1   2