Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Lie Ryan
On 05/02/10 10:58, Steven D'Aprano wrote: >> > And Python's object system >> > makes it that the argument to __getattr__ is always a string even though >> > there might be a valid variable that corresponds to it: > That is nothing to do with the object system, it is related to the > semantics of P

Re: Help needed in downloading Brown corpus

2010-05-01 Thread Adil Kaleem
On May 2, 6:30 am, Steven D'Aprano wrote: > On Sat, 01 May 2010 06:28:33 -0700, Adil Kaleem wrote: > > Hi all > > I'm a masters student in NLP. I needed to download the Brown corpus. I'm > > unable to download from nltk.org with the python CLI. My network > > connection is behind a proxy server so

sometype.__new__ and C subclasses

2010-05-01 Thread James Porter
I've been trying to write a Python C extension module that uses NumPy and has a subtype of numpy.ndarray written in C. However, I've run into a snag: calling numpy.ndarray.__new__(mysubtype, ...) triggers an exception in the bowels of Python (this is necessary for a handful of NumPy features).

Re: Help needed in downloading Brown corpus

2010-05-01 Thread Adil Kaleem
On May 1, 10:54 pm, Peter Pearson wrote: > > As I understand it (from Wikipedia), the Brown Corpus is a > collection of samples of modern American English text, and > nltk.org provides a Python toolkit for exploring said Corpus. > > I'm trying to figure out whether you're trying to get the > Corp

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Chris Rebert
On Sat, May 1, 2010 at 10:05 PM, Alf P. Steinbach wrote: > On 02.05.2010 06:06, * Aahz: >> In article<4bdcd631$0$27782$c3e8...@news.astraweb.com>, >> Steven D'Aprano  wrote: >>> >>> On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote: The += family of operators really do rebind the symbo

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Alf P. Steinbach
On 02.05.2010 06:06, * Aahz: In article<4bdcd631$0$27782$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote: The += family of operators really do rebind the symbol, not modify the object. They potentially do both, depending on the object,

Re: [capi-sig] SWIG + expy

2010-05-01 Thread Stefan Behnel
Jack Jansen, 01.05.2010 23:40: I would be very interested in a universal intermediate format for all the interface generators. I'm still using a version of Guido's old bgen, now grudgingly extended to handle C++ and do bidirectional bridging between Python and C++, and while I love and cherish th

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Aahz
In article <4bdcd631$0$27782$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: >On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote: >> >> The += family of operators really do rebind the symbol, not modify the >> object. > >They potentially do both, depending on the object, even for built-ins.

Re: Ignoring XML Namespaces with cElementTree

2010-05-01 Thread dmtr
> Unless you have multiple namespaces or are working with defined schema > or something, it's useless boilerplate. > > It'd be a nice feature if ElementTree could let users optionally > ignore a namespace, unfortunately it doesn't have it. Yep. Exactly my point. Here's a link to the patch address

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Patrick Maupin
On May 1, 9:03 pm, Chris Rebert wrote: > In both cases, __iOP__ operator methods are being used, not vanilla > __OP__ methods, so neither of your examples are relevant to Mr. > Chase's point. Well, Tim's main assertion was: "The += family of operators really do rebind the symbol, not modify the o

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Steven D'Aprano
On Sat, 01 May 2010 19:03:04 -0700, Chris Rebert wrote: > On Sat, May 1, 2010 at 6:32 PM, Steven D'Aprano > wrote: >> On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote: >>> This doesn't preclude you from implementing a self-mutating += style >>> __add__ method and returning "self", but it's usu

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Chris Rebert
On Sat, May 1, 2010 at 6:32 PM, Steven D'Aprano wrote: > On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote: >> This doesn't preclude you from implementing a self-mutating += style >> __add__ method and returning "self", but it's usually a bad idea > > Obviously the Python dev team don't agree wi

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Steven D'Aprano
On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote: > On 05/01/2010 12:08 AM, Patrick Maupin wrote: >> +=, -=, /=, *=, etc. conceptually (and, if lhs object supports in- >> place operator methods, actually) *modify* the lhs object. >> >> Your proposed .= syntax conceptually *replaces* the lhs ob

Re: Help needed in downloading Brown corpus

2010-05-01 Thread Steven D'Aprano
On Sat, 01 May 2010 06:28:33 -0700, Adil Kaleem wrote: > Hi all > I'm a masters student in NLP. I needed to download the Brown corpus. I'm > unable to download from nltk.org with the python CLI. My network > connection is behind a proxy server so it's creating a problem. Since I > don't know a bit

Re: Fast Efficient way to transfer an object to another list

2010-05-01 Thread Steven D'Aprano
On Sat, 01 May 2010 08:11:45 -0700, Francesco Bochicchio wrote: > On 1 Mag, 05:35, Steven D'Aprano > wrote: > > >> def transfer_stock(stock_code, old_list, new_list): >>     """ Transfer a stock from one list to another """ while True:  # >>     loop forever >>         try: >>             i = o

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Steven D'Aprano
On Sun, 02 May 2010 05:08:53 +1000, Lie Ryan wrote: > On 05/01/10 11:16, Steven D'Aprano wrote: >> On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote: >> >> In practice though, I think that's a difference that makes no >> difference. It walks like an operator, it swims like an operator, a

Re: Need direction on mass find/replacement in HTML files

2010-05-01 Thread Novocastrian_Nomad
One single line regex solution would be: re.sub(r'http\://www.mysite.org/\?page=([^"]+)',r'pages/\1.htm',html) -- http://mail.python.org/mailman/listinfo/python-list

Re: jpeg package

2010-05-01 Thread Vincent Davis
This gets you the cached page link I also fond some of the source pages in googles cache *Vincent Davis 720-301-3003 * vinc...@vincentda

Re: [capi-sig] SWIG + expy

2010-05-01 Thread Jack Jansen
On 27-Apr-2010, at 08:30 , Yingjie Lan wrote: > Hi, > > Is it possible to use SWIG to parse C/C++, and provide an interface for me to > generate some code? I thought it might be good to have SWIG help generate > expy (see http://expy.sourceforge.net) files, then generate the python > extensi

Re: matching strings in a large set of strings

2010-05-01 Thread News123
Dennis Lee Bieber wrote: > On Sat, 01 May 2010 13:48:02 +0200, News123 declaimed > the following in gmane.comp.python.general: > >> Dennis Lee Bieber wrote: >>> That lets you do a binary search on the file. Much faster than a >>> linear search (linear search will average out to 41.5M read ope

jpeg package

2010-05-01 Thread Paul Johnston
Hi, I've used the jpeg library on PyPI in the past and it's been great: http://pypi.python.org/pypi/jpeg/0.1.4 However, the library home page is now unaccessible. I can't even find the library on archive.org. Any idea how I can get it? http://www.emilas.com/jpeg/ Thanks, Paul -- http://mail.py

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread D'Arcy J.M. Cain
On Sun, 02 May 2010 05:08:53 +1000 Lie Ryan wrote: > On 05/01/10 11:16, Steven D'Aprano wrote: > > On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote: > > > > In practice though, I think that's a difference that makes no difference. > > It walks like an operator, it swims like an operato

Re: recommended way to insert data into a one to many relationship using python

2010-05-01 Thread Peter Otten
Wolfgang Meiners wrote: > Hi, > > one to many relationships are fairly common, i think. So there should be > a recommended way to insert data into such a relation using python. > > > Given the following programm, what is the recommended way to insert the > list of NewEmployees to the database?

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Patrick Maupin
On May 1, 7:13 am, Tim Chase wrote: > On 05/01/2010 12:08 AM, Patrick Maupin wrote: > > > +=, -=, /=, *=, etc.  conceptually (and, if lhs object supports in- > > place operator methods, actually) *modify* the lhs object. > > > Your proposed .= syntax conceptually *replaces* the lhs object > > (act

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Lie Ryan
On 05/01/10 11:16, Steven D'Aprano wrote: > On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote: > > In practice though, I think that's a difference that makes no difference. > It walks like an operator, it swims like an operator, and it quacks like > an operator. > Nope it's not. A ful

Re: Help needed in downloading Brown corpus

2010-05-01 Thread Peter Pearson
On Sat, 1 May 2010 06:28:33 -0700 (PDT), Adil Kaleem wrote: > Hi all > I'm a masters student in NLP. I needed to download the Brown corpus. > I'm unable to download from nltk.org with the python CLI. My network > connection is behind a proxy server so it's creating a problem. Since > I don't know a

recommended way to insert data into a one to many relationship using python

2010-05-01 Thread Wolfgang Meiners
Hi, one to many relationships are fairly common, i think. So there should be a recommended way to insert data into such a relation using python. Given the following programm, what is the recommended way to insert the list of NewEmployees to the database?

Re: Fast Efficient way to transfer an object to another list

2010-05-01 Thread Daniel Stutzbach
On Fri, Apr 30, 2010 at 9:16 PM, Jimbo wrote: > Hello I have a relatively simple thing to do; move an object from one > to list into another. But I think my solution maybe inefficient & > slow. > Removing an item from a list is O(n) on average, so it's going to be a bit slow any way you slice it

Re: Windows7 run python script / sub process with elevated privileges

2010-05-01 Thread News123
I Found a first solution, though not very satisfying: News123 wrote: > Hi, > > I have a small python script, which has been started as normal non > privileged user. > > At a later point in time it would like to start another python script > with elevated privileges. > > How can I write my code s

Re: Fast Efficient way to transfer an object to another list

2010-05-01 Thread Francesco Bochicchio
On 1 Mag, 05:35, Steven D'Aprano wrote: > > def transfer_stock(stock_code, old_list, new_list): >     """ Transfer a stock from one list to another """ >     while True:  # loop forever >         try: >             i = old_list.index(stock_code) >         except ValueError: >             # not fo

Re: Fast Efficient way to transfer an object to another list

2010-05-01 Thread MRAB
Tim Chase wrote: On 04/30/2010 10:35 PM, Steven D'Aprano wrote: If you know there is one, and only one, item with that stock code: def transfer_stock(stock_code, old_list, new_list): """ Transfer a stock from one list to another """ i = old_list.index(stock_code) # search new_li

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Alf P. Steinbach
On 01.05.2010 14:13, * Tim Chase: On 05/01/2010 12:08 AM, Patrick Maupin wrote: +=, -=, /=, *=, etc. conceptually (and, if lhs object supports in- place operator methods, actually) *modify* the lhs object. Your proposed .= syntax conceptually *replaces* the lhs object (actually, rebinds the lhs

Windows7 run python script / sub process with elevated privileges

2010-05-01 Thread News123
Hi, I have a small python script, which has been started as normal non privileged user. At a later point in time it would like to start another python script with elevated privileges. How can I write my code such, that I will get the privilege elevation prompt and I can start a sub process / pyt

Re: Help needed in downloading Brown corpus

2010-05-01 Thread Shashank Singh
try this: run this in your terminal before you hit nltk.download(). Don't forget to set username, password and proxy info for your own system.(in PROXY_INFO) import urllib2 PROXY_INFO = { 'user' : username, 'pass' : password, 'host' : proxy_server, 'port' : proxy_port } proxy_support =

Help needed in downloading Brown corpus

2010-05-01 Thread Adil Kaleem
Hi all I'm a masters student in NLP. I needed to download the Brown corpus. I'm unable to download from nltk.org with the python CLI. My network connection is behind a proxy server so it's creating a problem. Since I don't know a bit of python, so unable to figure a way out. Can someone help me in

Re: Fast Efficient way to transfer an object to another list

2010-05-01 Thread Tim Chase
On 04/30/2010 10:35 PM, Steven D'Aprano wrote: If you know there is one, and only one, item with that stock code: def transfer_stock(stock_code, old_list, new_list): """ Transfer a stock from one list to another """ i = old_list.index(stock_code) # search new_list.append(old_list

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Stefan Behnel
Tim Chase, 01.05.2010 14:13: On 05/01/2010 12:08 AM, Patrick Maupin wrote: +=, -=, /=, *=, etc. conceptually (and, if lhs object supports in- place operator methods, actually) *modify* the lhs object. Your proposed .= syntax conceptually *replaces* the lhs object (actually, rebinds the lhs symb

Re: matching strings in a large set of strings

2010-05-01 Thread Stefan Behnel
Duncan Booth, 30.04.2010 10:20: So more than 3GB just for the strings (and that's for Python 2.x on Python 3.x you'll need nearly 5GB). Running on a 64 bit version of Python should be fine, but for a 32 bit system a naive approach just isn't going to work. Option 1: use a trie. That should redu

Re: Python dot-equals (syntax proposal)

2010-05-01 Thread Tim Chase
On 05/01/2010 12:08 AM, Patrick Maupin wrote: +=, -=, /=, *=, etc. conceptually (and, if lhs object supports in- place operator methods, actually) *modify* the lhs object. Your proposed .= syntax conceptually *replaces* the lhs object (actually, rebinds the lhs symbol to the new object). The

Re: Ignoring XML Namespaces with cElementTree

2010-05-01 Thread Stefan Behnel
Carl Banks, 01.05.2010 12:33: On Apr 29, 10:12 pm, Stefan Behnel wrote: dmtr, 30.04.2010 04:57: I don't want these "{http://www.very_long_url.com}"; in front of my tags. They create performance disaster on large files I seriously doubt that they do. I don't know what kind of XML files you

Re: http://pypi.python.org/pypi

2010-05-01 Thread Martin v. Loewis
> I have only access to the webpage form too upload my one file. > pkginfo is ok, just want to at a single .py file instead of a complete > site-package tar directory, because it is not a site-package, its more > like a single exe file. Uploading individual .py files is not supported. If it's not

Re: Use Regular Expressions to extract URL's

2010-05-01 Thread Walter Overby
A John Gruber post from November seems relevant. I have not tried his regex in any language. http://daringfireball.net/2009/11/liberal_regex_for_matching_urls Regards, Walter. -- http://mail.python.org/mailman/listinfo/python-list

Re: matching strings in a large set of strings

2010-05-01 Thread News123
Dennis Lee Bieber wrote: > On Thu, 29 Apr 2010 11:38:28 +0200, "Karin Lagesen" > declaimed the following in comp.lang.python: > >> Hello. >> >> I have approx 83 million strings, all 14 characters long. I need to be >> able to take another string and find out whether this one is present >> within

Re: Performance of list.index - how to speed up a silly algorithm?

2010-05-01 Thread Laszlo Nagy
Maybe this should be implemented in C. But I believe that the algorithm itself must be wrong (regardless of the language). I really think that I'm doing something wrong. Looks like my algorithm's processing time is not linear to the number of rows. Not even log(n)*n. There should be a more ef

PyObject_SetAttrString - doesn't set instance attribute

2010-05-01 Thread Jason
I'm having a bit of trouble with C/Python bindings. Particularly, trying to set an instance variable from C when the object is initialised using PyObject_SetAttrString, but nothing seems to happen. The C initialisation code is: static void nautilus_python_object_instance_init (NautilusPythonObject

Re: Python daemonisation with python-daemon

2010-05-01 Thread Ben Finney
Thomas Courbon writes: > I would like to turn my server script into a Linux/Unix daemon > (launched at boot time by init, dunno if that matter) using the nice > python-daemon package by Ben Finley et al I resemble that name :-) > This package comes with a class DaemonRunner that seems to fit al

Re: CGI python 3 write RAW BINARY

2010-05-01 Thread Dodo
Le 30/04/2010 17:52, Antoine Pitrou a écrit : Le Thu, 29 Apr 2010 23:37:32 +0200, Dodo a écrit : I don't get a thing. Now with the fix : All browsers shows a different thing, but not the image! http://ddclermont.homeip.net/misc/python/ If I save it to computer : * Windows image viewer won't

Re: Ignoring XML Namespaces with cElementTree

2010-05-01 Thread Carl Banks
On Apr 29, 10:12 pm, Stefan Behnel wrote: > dmtr, 30.04.2010 04:57: > > > > > I'm referring to xmlns/URI prefixes. Here's a code example: > >   from xml.etree.cElementTree import iterparse > >   from cStringIO import StringIO > >   xml = """http://www.very_long_url.com";> > root>""" > >   for even

Re: Ignoring XML Namespaces with cElementTree

2010-05-01 Thread Carl Banks
On Apr 27, 6:42 pm, dmtr wrote: > Is there any way to configure cElementTree to ignore the XML root > namespace?  Default cElementTree (Python 2.6.4) appears to add the XML > root namespace URI to _every_ single tag.  I know that I can strip > URIs manually, from every tag, but it is a rather idio

Online survey jobs & data entry jobs

2010-05-01 Thread online jobs
http://teluguscope.com/job.html http://teluguscope.com/links/onlinedataentryjobs.html http://teluguscope.com/links/Copy%20Past%20jobs.html http://teluguscope.com/links/Work%20from%20Home.html http://teluguscope.com/links/Formfilling%20jobs.html http://teluguscope.com/links/Survey%20Jobs.html -

Re: External Hashing [was Re: matching strings in a large set of strings]

2010-05-01 Thread Jack
http://www.swizwatch.com/ All Cartier replica watches sold at Hotwristwatch.com are brand-new and high quality. Each Cartier Replica Watch produced is examined carefully by our quality test department and each watch is inspected again before being sent to our customer. It is our desire that you do