Use Regular Expressions to extract URL's

2010-04-30 Thread Jimbo
Hello I am using regular expressions to grab URL's from a string(of HTML code). I am getting on very well I seem to be grabbing the full URL [b]but[/b] I also get a '' character at the end of it. Do you know how I can get rid of the '' char at the end of my URL [b]Example of problem:[/b]

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

2010-04-30 Thread Peter Otten
MRAB wrote: The .index method does a linear search, checking on average 1/2 of the items in the list. That's why it's so slow. In order to avoid that you could build a dict of each value in dimension_values[col_idx] and its index in a single pass so that it becomes a quick lookup. For

Re: matching strings in a large set of strings

2010-04-30 Thread Paul Rudin
Karin Lagesen karin.lage...@bio.uio.no writes: 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 the 83 million strings. Now, I have tried storing these strings as a list, a set and a

Re: How to get ipRouteTable from Cisco router?

2010-04-30 Thread gvozdikov
On 29 апр, 19:12, gvozdikov t1k0v.s...@gmail.com wrote: Hello! I want to get route tables from Cisco routers in the network. What i have: import re from pysnmp.entity.rfc3413.oneliner import cmdgen s = r'(%s)' % ('(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.)\

Re: matching strings in a large set of strings

2010-04-30 Thread Duncan Booth
Paul Rudin paul.nos...@rudin.co.uk wrote: Shouldn't a set with 83 million 14 character strings be fine in memory on a stock PC these days? I suppose if it's low on ram you might start swapping which will kill performance. Perhaps the method you're using to build the data structures creates

Re: matching strings in a large set of strings

2010-04-30 Thread Steven D'Aprano
On Fri, 30 Apr 2010 08:23:39 +0100, Paul Rudin wrote: Karin Lagesen karin.lage...@bio.uio.no writes: 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 the 83 million strings. Now, I

Re: matching strings in a large set of strings

2010-04-30 Thread Paul Rudin
Duncan Booth duncan.bo...@invalid.invalid writes: Paul Rudin paul.nos...@rudin.co.uk wrote: Shouldn't a set with 83 million 14 character strings be fine in memory on a stock PC these days? I suppose if it's low on ram you might start swapping which will kill performance. Perhaps the method

Re: Use Regular Expressions to extract URL's

2010-04-30 Thread Steven D'Aprano
On Thu, 29 Apr 2010 23:53:06 -0700, Jimbo wrote: Hello I am using regular expressions to grab URL's from a string(of HTML code). I am getting on very well I seem to be grabbing the full URL [b]but[/b] I also get a '' character at the end of it. Do you know how I can get rid of the ''

Re: matching strings in a large set of strings

2010-04-30 Thread Christian Heimes
s = 12345678901234 assert len(s) == 14 import sys sys.getsizeof(s) 38 So a single 14 char string takes 38 bytes. Make that at least 40 bytes. You have to take memory alignment into account. So a set with 83000 such strings takes approximately 1 MB. So far fairly trivial. But that's just the

Re: array matching

2010-04-30 Thread Jean-Michel Pichavant
Bill Jordan wrote: Hey guys, I am sorry if this is not the right list to post some questions. I have a simple question please and would appreciate some answers as I am new to Python. I have 2 D array: test = [[A,1],[B,2],[A,3][B,4]] I want to arrang this array in different arrays so each

Adorable Pancreas

2010-04-30 Thread Lawrence D'Oliveiro
I want to use that as a code name for some software project. Perhaps for a release where a lot of work has gone on behind the scenes, not necessarily visible to the user. It’s from the Jean Kerr quote: “I’m tired of all this nonsense about beauty being skin deep. That’s deep enough. What do

Re: replacing words in HTML file

2010-04-30 Thread Walter Dörwald
On 28.04.10 15:02, james_027 wrote: hi, Any idea how I can replace words in a html file? Meaning only the content will get replace while the html tags, javascript, css are remain untouch. You could try XIST (http://www.livinglogic.de/Python/xist/): Example code: from ll.xist import xsc,

Re: Cross-platform way to retrieve the current (Operative system) DNS server IP address in python

2010-04-30 Thread Hans Mulder
joamag wrote: It's not my ip address that I want to discover... I want to discover my default dns server ip address. This ip is stored in an operative system basis. Dos anyone know how to get it ? You asked for a cross-platform solution; there probably isn't one. The code below works on

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

2010-04-30 Thread Laszlo Nagy
The .index method does a linear search, checking on average 1/2 of the items in the list. That's why it's so slow. In order to avoid that you could build a dict of each value in dimension_values[col_idx] and its index in a single pass so that it becomes a quick lookup. For example:

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 04/30/10 13:21, Steven D'Aprano wrote: On Fri, 30 Apr 2010 05:41:26 +1000, Lie Ryan wrote: On 04/29/10 20:40, Gregory Ewing wrote: Lie Ryan wrote: No, the implicit concatenation is there because Python didn't always have triple quoted string. Nowadays it's an artifact and triple quoted

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 04/30/10 12:07, Alf P. Steinbach wrote: On 30.04.2010 01:29, * Carl Banks: On Apr 28, 11:16 am, Alf P. Steinbachal...@start.no wrote: On 28.04.2010 18:54, * Lie Ryan: Python have triple-quoted string when you want to include large amount of text; Yes, that's been mentioned umpteen

Accessing an instance of a class from within instance of another class

2010-04-30 Thread Stefan Krastanov
Hello all, I have some knowledge of programing in C++ and I believe that I understand the way one should write programs in Python. But I need some help finding the Right Way for doing a thing. Here is the problem: I have a class (call it Data) that has a number of NumPy arrays and some methods

Re: ooolib, reading writing a spread sheet and keep formatting

2010-04-30 Thread Lie Ryan
On 04/30/10 05:58, News123 wrote: cjw wrote: However: I'd like to read in a spreadsheet, perform only minor modifications and write it back with the exact formatting. this is unfortunately not working. Do you know that Python is one of OpenOffice's macro language? Python macro have the full

Re: Adorable Pancreas

2010-04-30 Thread Ben Finney
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: It’s from the Jean Kerr quote: “I’m tired of all this nonsense about beauty being skin deep. That’s deep enough. What do you want, an adorable pancreas?” Insulin, glucagon; comin' from the Islets of Langerhans.

Possible to import from an in-memory zipfile stored in a cString?

2010-04-30 Thread python
Any ideas on whether or not it is possible to import from an in-memory zipfile stored in a cString vs. an on disk zipfile? This seems like it should be possible and perhaps even something that someone's already coded a solution for? Would love to hear your comments before going down a blind path

Re: assigning multi-line strings to variables

2010-04-30 Thread Alf P. Steinbach
On 30.04.2010 12:51, * Lie Ryan: On 04/30/10 12:07, Alf P. Steinbach wrote: On 30.04.2010 01:29, * Carl Banks: On Apr 28, 11:16 am, Alf P. Steinbachal...@start.no wrote: On 28.04.2010 18:54, * Lie Ryan: Python have triple-quoted string when you want to include large amount of text;

Re: Accessing an instance of a class from within instance of another class

2010-04-30 Thread Paul Kölle
Am 30.04.2010 13:05, schrieb Stefan Krastanov: Hello all, [snipp] Here is the problem: I have a class (call it Data) that has a number of NumPy arrays and some methods that get useful information from the arrays (math stuff). I have two other classes (called Viewer1 and Viewer2) (they are

ANN: Wing IDE 3.2.6 released

2010-04-30 Thread Wingware
Hi, Wingware has released version 3.2.6 of Wing IDE, an integrated development environment designed specifically for the Python programming language. This release includes the following minor features and improvements: * Added Copy to Clipboard in Source Assistant * Added ability to clear

Re: find integers in f.readline()

2010-04-30 Thread MRAB
elsa wrote: Hi people, I'm having a problem getting the info I need out of a file. I've opened the file with f=open('myFile','r'). Next, I take out the first line with line=f.readline() line looks like this: '83927 300023_25_5_09_FL 9086 9134 F3LQ2BE01AQLXF 1 49 + 80 ZA8Z89HIB7M' I then

Re: Possible to import from an in-memory zipfile stored in a cString?

2010-04-30 Thread Tim Chase
On 04/30/2010 08:55 AM, pyt...@bdurham.com wrote: Any ideas on whether or not it is possible to import from an in-memory zipfile stored in a cString vs. an on disk zipfile? Based on the source-code to zipfile.py on my Debian machine, it looks like the zipfile.ZipFile constructor takes a file

Python daemonisation with python-daemon

2010-04-30 Thread Thomas Courbon
Hello there, I currently have a little project which involve the writing of a server that launch tasks when requested by the user (through a web interface for instance). 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

Re: building python 3 -- _dbm necessary bits

2010-04-30 Thread Mark Olbert
James, Thanks for the advice. I looked at the contents of a gdbm-devel package on the web, and compared it, file by file, to my system. I noticed that the online package had three files: /usr/include/gdbm/dbm.h /usr/include/gdbm/gdbm.h /usr/include/gdbm/ndbm.h which on my system are

Re: CGI python 3 write RAW BINARY

2010-04-30 Thread Antoine Pitrou
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 read it * Irfanview can read it without

Re: building python 3 -- _dbm necessary bits

2010-04-30 Thread Antoine Pitrou
Le Fri, 30 Apr 2010 08:14:21 -0700, Mark Olbert a écrit : Do you know how I can report this issue to the developers so that the Python build script can be modified to look for the gdbm files in /usr/include? You can post an issue at http://bugs.python.org Regards Antoine. --

Re: Issues while building pyfsevents in python 3.1

2010-04-30 Thread Aahz
In article mailman.2389.1272569408.23598.python-l...@python.org, Terry Reedy tjre...@udel.edu wrote: On 4/29/2010 2:30 AM, mathan kumar wrote: I m trying port pyfsevents coded in python2.6 to python3.1. Specifying system and compiler/version might help responders. Also, pyobjc-dev is probably

Python dot-equals (syntax proposal)

2010-04-30 Thread Jabapyth
At least a few times a day I wish python had the following shortcut syntax: vbl.=func(args) this would be equivalent to vbl = vbl.func(args) example: foo = Hello world foo.=split( ) print foo # ['Hello', 'world'] and I guess you could generalize this to vbl.=[some text] # vbl = vbl.[some

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread J. Cliff Dyer
That's kind of a nifty idea. However, python is currently under a syntax moratorium. No syntax changes will be accepted for at least 24 months starting from the release date of Python 3.1. See more details here: http://www.python.org/dev/peps/pep-3003/ Cheers, Cliff On Fri, 2010-04-30 at

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Stefan Behnel
J. Cliff Dyer, 30.04.2010 18:20: On Fri, 2010-04-30 at 09:04 -0700, Jabapyth wrote: At least a few times a day I wish python had the following shortcut syntax: vbl.=func(args) this would be equivalent to vbl = vbl.func(args) example: foo = Hello world foo.=split( ) print foo # ['Hello',

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread D'Arcy J.M. Cain
On Fri, 30 Apr 2010 09:04:59 -0700 (PDT) Jabapyth jabap...@gmail.com wrote: foo = Hello world foo.=split( ) Isn't; foo = Hello world bar = foo.split() # side note - split() splits on whitespace by default so much clearer? Do you really want to see Python turn into Perl? However, if you

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Peter Otten
Jabapyth wrote: At least a few times a day I wish python had the following shortcut syntax: vbl.=func(args) this would be equivalent to vbl = vbl.func(args) example: foo = Hello world foo.=split( ) print foo # ['Hello', 'world'] Extending a language comes at a cost, too. A

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Jean-Michel Pichavant
Jabapyth wrote: At least a few times a day I wish python had the following shortcut syntax: vbl.=func(args) this would be equivalent to vbl = vbl.func(args) example: foo = Hello world foo.=split( ) print foo # ['Hello', 'world'] and I guess you could generalize this to vbl.=[some text] #

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread John Bokma
D'Arcy J.M. Cain da...@druid.net writes: On Fri, 30 Apr 2010 09:04:59 -0700 (PDT) Jabapyth jabap...@gmail.com wrote: foo = Hello world foo.=split( ) Isn't; foo = Hello world bar = foo.split() # side note - split() splits on whitespace by default so much clearer? Do you really want to

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Chris Rebert
On Fri, Apr 30, 2010 at 10:05 AM, John Bokma j...@castleamber.com wrote: D'Arcy J.M. Cain da...@druid.net writes: On Fri, 30 Apr 2010 09:04:59 -0700 (PDT) Jabapyth jabap...@gmail.com wrote: foo = Hello world foo.=split( ) Isn't; foo = Hello world bar = foo.split() # side note - split()

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread D'Arcy J.M. Cain
On Fri, 30 Apr 2010 12:05:49 -0500 John Bokma j...@castleamber.com wrote: D'Arcy J.M. Cain da...@druid.net writes: so much clearer? Do you really want to see Python turn into Perl? Oh, boy, there we go again. Can you and your buddies please refrain from using Perl as a kind of

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Lie Ryan
On 05/01/10 02:50, Jean-Michel Pichavant wrote: Jabapyth wrote: At least a few times a day I wish python had the following shortcut syntax: snip currentCar = Car() currentCar = currentCar.nextCar The syntax you prose will be applicable on very little assignements (use case 3). I'm not

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 05/01/10 00:01, Alf P. Steinbach wrote: On 30.04.2010 12:51, * Lie Ryan: On 04/30/10 12:07, Alf P. Steinbach wrote: On 30.04.2010 01:29, * Carl Banks: On Apr 28, 11:16 am, Alf P. Steinbachal...@start.no wrote: On 28.04.2010 18:54, * Lie Ryan: Python have triple-quoted string when you

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

2010-04-30 Thread Helmut Jarausch
I think one could apply an external hashing technique which would require only very few disk accesses per lookup. Unfortunately, I'm now aware of an implementation in Python. Does anybody know about a Python implementation of external hashing? Thanks, Helmut. -- Helmut Jarausch Lehrstuhl fuer

Re: assigning multi-line strings to variables

2010-04-30 Thread Alf P. Steinbach
On 30.04.2010 19:31, * Lie Ryan: On 05/01/10 00:01, Alf P. Steinbach wrote: On 30.04.2010 12:51, * Lie Ryan: On 04/30/10 12:07, Alf P. Steinbach wrote: On 30.04.2010 01:29, * Carl Banks: On Apr 28, 11:16 am, Alf P. Steinbachal...@start.nowrote: On 28.04.2010 18:54, * Lie Ryan: Python

Re: assigning multi-line strings to variables

2010-04-30 Thread Neil Cerutti
On 2010-04-30, Lie Ryan lie.1...@gmail.com wrote: Use triple-quoted, let them flow, done. I've never heard of any text editor in current use without text wrapping capability, even Notepad has it. And if I've got 5k of text in source code without line breaks I wouldn't want that silly string

Re: Use Regular Expressions to extract URL's

2010-04-30 Thread Novocastrian_Nomad
Or perhaps more generically: import re string = 'scatter http://.yahoo.com quotes and text anywhere www.google.com www.bing.com or not' print re.findall(r'(?:http://|www.)[^\s]+',string) ['http://.yahoo.com', 'www.google.com', 'www.bing.com'] --

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread John Bokma
Chris Rebert c...@rebertia.com writes: On Fri, Apr 30, 2010 at 10:05 AM, John Bokma j...@castleamber.com wrote: [..] On top of that, it's not possible in Perl (heh, no surprise there). The only thing that comes close is: Actually/ironically, it does appear to be in Perl 6: Mutating

Re: External Hashing

2010-04-30 Thread John Bokma
Helmut Jarausch jarau...@igpm.rwth-aachen.de writes: I think one could apply an external hashing technique which would require only very few disk accesses per lookup. Unfortunately, I'm now aware of an implementation in Python. Does anybody know about a Python implementation of external

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

2010-04-30 Thread gert
On Apr 29, 10:49 pm, James Mills prolo...@shortcircuit.net.au wrote: On Fri, Apr 30, 2010 at 5:53 AM, gert gert.cuyk...@gmail.com wrote: How do you upload a plain text .py file as a source file? http://lmgtfy.com/?q=python+distutils+tutorial http://lmgtfy.com/?q=does+not+work :) I have only

Re: Looking for registration package

2010-04-30 Thread Aahz
In article hqnrgs$sm...@reader1.panix.com, kj no.em...@please.post wrote: I'm looking for a Python-based, small, self-contained package to hand out API keys, in the same spirit as Google API keys. The basic specs are simple: 1) enforce the one key per customer rule; 2) be robot-proof; 3) be

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Aahz
In article 87zl0klvki@castleamber.com, John Bokma j...@castleamber.com wrote: Why I am asking this is that most Oh, like Perl statements I've seen the past months were made by people who either haven't used Perl themselves or have very little skill in the language. What evidence do you

Dynamically change __del__

2010-04-30 Thread Nikolaus Rath
Hi, I'm trying to be very clever: class tst(object): def destroy(self): print 'Cleaning up.' self.__del__ = lambda: None def __del__(self): raise RuntimeError('Instance destroyed without running destroy! Hell may break loose!') However, it doesn't work:

Re: Dynamically change __del__

2010-04-30 Thread Jerry Hill
On Fri, Apr 30, 2010 at 3:16 PM, Nikolaus Rath nikol...@rath.org wrote: Apparently Python calls the class attribute __del__ rather than the instance's __del__ attribute. Is that a bug or a feature? Is there any way to implement the desired functionality without introducing an additional

Re: Dynamically change __del__

2010-04-30 Thread Lie Ryan
On 05/01/10 05:16, Nikolaus Rath wrote: Hi, I'm trying to be very clever: snip Apparently Python calls the class attribute __del__ rather than the instance's __del__ attribute. Is that a bug or a feature? Is there any way to implement the desired functionality without introducing an

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 05/01/10 04:08, Neil Cerutti wrote: On 2010-04-30, Lie Ryan lie.1...@gmail.com wrote: Use triple-quoted, let them flow, done. I've never heard of any text editor in current use without text wrapping capability, even Notepad has it. And if I've got 5k of text in source code without line

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

2010-04-30 Thread Tim Chase
On 04/30/2010 12:51 PM, Helmut Jarausch wrote: I think one could apply an external hashing technique which would require only very few disk accesses per lookup. Unfortunately, I'm now aware of an implementation in Python. Does anybody know about a Python implementation of external hashing?

Access class from staticmethod

2010-04-30 Thread Thomas Allen
Is that possible? class A(object): @staticmethod def set_b(x): # A.b = x, without knowing A is A pass Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamically change __del__

2010-04-30 Thread Peter Otten
Nikolaus Rath wrote: Apparently Python calls the class attribute __del__ rather than the instance's __del__ attribute. Is that a bug or a feature? Is there any way to implement the desired functionality without introducing an additional destroy_has_been_called attribute? For newstyle classes

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 05/01/10 03:56, Alf P. Steinbach wrote: Use triple-quoted, let them flow, done. I've never heard of any text editor in current use without text wrapping capability, even Notepad has it. And if I've got 5k of text in source code without line breaks I wouldn't want that silly string to

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 05/01/10 05:43, Lie Ryan wrote: On 05/01/10 03:56, Alf P. Steinbach wrote: Use triple-quoted, let them flow, done. I've never heard of any text editor in current use without text wrapping capability, even Notepad has it. And if I've got 5k of text in source code without line breaks I

Re: Access class from staticmethod

2010-04-30 Thread Thomas Allen
Ah ha, @classmethod. On Apr 30, 3:47 pm, Thomas Allen thomasmal...@gmail.com wrote: Is that possible? class A(object):   @staticmethod   def set_b(x):     # A.b = x, without knowing A is A     pass Thomas -- http://mail.python.org/mailman/listinfo/python-list

Need direction on mass find/replacement in HTML files

2010-04-30 Thread KevinUT
Hello Folks: I want to globally change the following: a href=http:// www.mysite.org/?page=contactsfont color=#269BD5 into: a href=pages/contacts.htmfont color=#269BD5 You'll notice that the match would be http://www.mysite.org/?page= but I also need to add a .htm to the end of contacts so it

Re: Dynamically change __del__

2010-04-30 Thread Lie Ryan
On 05/01/10 05:39, Lie Ryan wrote: On 05/01/10 05:16, Nikolaus Rath wrote: Hi, I'm trying to be very clever: snip Apparently Python calls the class attribute __del__ rather than the instance's __del__ attribute. Is that a bug or a feature? Is there any way to implement the desired

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Brendan Abel
On Apr 30, 9:04 am, Jabapyth jabap...@gmail.com wrote: At least a few times a day I wish python had the following shortcut syntax: vbl.=func(args) this would be equivalent to vbl = vbl.func(args) example: foo = Hello world foo.=split( ) print foo # ['Hello', 'world'] and I guess

Re: Looking for registration package

2010-04-30 Thread gb345
In hrf8s3$6s...@panix5.panix.com a...@pythoncraft.com (Aahz) writes: In article hqnrgs$sm...@reader1.panix.com, kj no.em...@please.post wrote: I'm looking for a Python-based, small, self-contained package to hand out API keys, in the same spirit as Google API keys. The basic specs are simple:

Re: [SOLVED] Calling multiple programs with subprocess

2010-04-30 Thread Amit Uttamchandani
On Sat, Apr 24, 2010 at 08:22:14AM +0530, Kushal Kumaran wrote: [snip] Run a shell (cmd.exe, I think) using subprocess and send it the commands you want to run using the communicate() method. Actually, I ended up using stdin.write('...\n'), and it works as expected: # #

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

2010-04-30 Thread Peter Otten
KevinUT wrote: Hello Folks: I want to globally change the following: a href=http:// www.mysite.org/?page=contactsfont color=#269BD5 into: a href=pages/contacts.htmfont color=#269BD5 You'll notice that the match would be http://www.mysite.org/?page= but I also need to add a .htm to the

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

2010-04-30 Thread Dave Angel
Helmut Jarausch wrote: I think one could apply an external hashing technique which would require only very few disk accesses per lookup. Unfortunately, I'm now aware of an implementation in Python. Does anybody know about a Python implementation of external hashing? Thanks, Helmut. That's

Inheritable computed class attributes?

2010-04-30 Thread kj
I want to define a class attribute that is computed from other class attributes. Furthermore, this attribute should be inheritable, and its value in the subclasses should reflect the subclasses values of the attributes used to compute the computed attribute. I tried the following: class

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

2010-04-30 Thread Tim Chase
On 04/30/2010 02:54 PM, KevinUT wrote: I want to globally change the following:a href=http:// www.mysite.org/?page=contactsfont color=#269BD5 into:a href=pages/contacts.htmfont color=#269BD5 Normally I'd just do this with sed on a *nix-like OS: find . -iname '*.html' -exec sed -i.BAK

Re: Difference between Popen and open() for reading a file

2010-04-30 Thread Aahz
In article mailman.2142.1271960906.23598.python-l...@python.org, J dreadpiratej...@gmail.com wrote: Say I had a file, foo.txt that I wanted to read from, only one time and only read. So what's the difference between this: mylist = Popen([cat,foo.txt], stdout=PIPE).communicate()[0].splitlines()

Re: Inheritable computed class attributes?

2010-04-30 Thread Lie Ryan
On 05/01/10 06:42, kj wrote: I want to define a class attribute that is computed from other class attributes. Furthermore, this attribute should be inheritable, and its value in the subclasses should reflect the subclasses values of the attributes used to compute the computed attribute. I

Re: assigning multi-line strings to variables

2010-04-30 Thread Alf P. Steinbach
On 30.04.2010 21:46, * Lie Ryan: On 05/01/10 05:43, Lie Ryan wrote: On 05/01/10 03:56, Alf P. Steinbach wrote: Use triple-quoted, let them flow, done. I've never heard of any text editor in current use without text wrapping capability, even Notepad has it. And if I've got 5k of text in

Re: Ignoring XML Namespaces with cElementTree

2010-04-30 Thread dmtr
I think that's your main mistake: don't remove them. Instead, use the fully qualified names when comparing. Stefan Yes. That's what I'm forced to do. Pre-calculating tags like tagChild = {%s}child % uri and using them instead of child. As a result the code looks ugly and there is extra

Re: assigning multi-line strings to variables

2010-04-30 Thread Alf P. Steinbach
On 30.04.2010 21:40, * Lie Ryan: On 05/01/10 04:08, Neil Cerutti wrote: On 2010-04-30, Lie Ryanlie.1...@gmail.com wrote: Use triple-quoted, let them flow, done. I've never heard of any text editor in current use without text wrapping capability, even Notepad has it. And if I've got 5k of text

Re: assigning multi-line strings to variables

2010-04-30 Thread Lie Ryan
On 05/01/10 07:54, Alf P. Steinbach wrote: You'd put a 5K line in your source code, + you're working with text wrapping in your editor. In the other hand, you'd put a 5K line in your source code, + you're writing, debugging, and running a script to wrap and put various escapes for quotes

Re: Inheritable computed class attributes?

2010-04-30 Thread kj
In 4bdb4e4...@dnews.tpgi.com.au Lie Ryan lie.1...@gmail.com writes: class MetaSpam(type): @property def Y(cls): return cls.X * 3 class Spam(object): __metaclass__ = MetaSpam and there we go: class Ham(Spam): ... X = 7 ... class Eggs(Spam): ... X = '.' ... Ham.Y;

Re: Ignoring XML Namespaces with cElementTree

2010-04-30 Thread dmtr
Here's a link to the patch exposing this parameter: http://bugs.python.org/issue8583 -- http://mail.python.org/mailman/listinfo/python-list

Bug Search Browser Plugin (Firefox)

2010-04-30 Thread Vincent Davis
The Bug Search Browser Plugin (Firefox) http://python.org/dev/searchplugin does not seem to install. http://www.python.org/dev/searchplugin/ *Vincent Davis 720-301-3003 * vinc...@vincentdavis.net my blog http://vincentdavis.net | LinkedInhttp://www.linkedin.com/in/vincentdavis --

Re: Download Proprietary Microsoft Products Now

2010-04-30 Thread Lawrence D'Oliveiro
In message 530938a5-d865-4228-8d4a-402a39941...@k36g2000yqn.googlegroups.com, Andrej Mitrovic wrote: Sure beats having to recompile a kernel to support 3rd party audio drivers. Which is a less fraught process than {B7C0D3A0-F949-44AD-ACE5-FB845B8C1EB7} ing Registry edits, don’t you thin? You

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Steven D'Aprano
On Fri, 30 Apr 2010 18:50:46 +0200, Jean-Michel Pichavant wrote: Jabapyth wrote: At least a few times a day I wish python had the following shortcut syntax: vbl.=func(args) this would be equivalent to vbl = vbl.func(args) [...] Useless if you use meaningful names for your variables

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Steven D'Aprano
On Fri, 30 Apr 2010 12:34:34 -0400, D'Arcy J.M. Cain wrote: I assume you mean the former to be analagous to += and friends but I am not sure since . isn't an operator. It's a de facto operator. If you google on python dot operator you will find many people who refer to it as such, and

ANN: expy 0.6.5 released!

2010-04-30 Thread Yingjie Lan
EXPY is an express way to extend Python! EXPY provides a way to extend python in an elegant way. For more information and a tutorial, see: http://expy.sourceforge.net/ What's new: 1. Correct treatment of __init__ method. 2. Give warnings of missing Py_INCREF on appropriate special type

Fast Efficient way to transfer an object to another list

2010-04-30 Thread Jimbo
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. Is there a faster better way to move my stock object from one list to another? (IE, without having to use a dictionary instead of a list or is that my only

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

2010-04-30 Thread Kushal Kumaran
On Sat, May 1, 2010 at 7:46 AM, Jimbo nill...@yahoo.com 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. Is there a faster better way to move my stock object from one list to another? (IE,

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

2010-04-30 Thread Steven D'Aprano
On Fri, 30 Apr 2010 19:16:04 -0700, 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. Is there a faster better way to move my stock object from one list to another? (IE, without having to

[no subject]

2010-04-30 Thread mannu jha
Dear all, I am trying my problem in this way: import re expr = re.compile(Helix Helix| Sheet Sheet| Turn Turn| Coil Coil) f = open(CalcSecondary4.txt) for line in f: if expr.search(line): print line but with this it is printing only those line in which helix, sheet, turn and coil

Re: winreg - access mask

2010-04-30 Thread Tim Roberts
Richard Lamboj richard.lam...@bilcom.at wrote: if i want to read, write a key and set a value, does i only need to set KEY_WRITE, or does i need to set KEY_READ, KEY_WRITE and KEY_SET_VALUE? This questions is related to the OpenKey Function. You need KEY_READ|KEY_WRITE|KEY_SET_VALUE. Those

Re: Python dot-equals (syntax proposal)

2010-04-30 Thread Patrick Maupin
On Apr 30, 11:04 am, Jabapyth jabap...@gmail.com wrote: At least a few times a day I wish python had the following shortcut syntax: vbl.=func(args) this would be equivalent to vbl = vbl.func(args) example: foo = Hello world foo.=split( ) print foo # ['Hello', 'world'] and I guess

[issue7946] Convoy effect with I/O bound threads and New GIL

2010-04-30 Thread Nir Aides
Nir Aides n...@winpdb.org added the comment: Dave, The behavior of your patch on Windows XP/2003 (and earlier) might be related to the way Windows boosts thread priority when it is signaled. Try to increase priority of monitor thread and slice size. Another thing to look at is how to

[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-04-30 Thread Paul Moore
New submission from Paul Moore p.f.mo...@gmail.com: test_support.find_unused_port attempts to find an unused port to use. The approach is fragile (as noted in the docstring) in certain cases. In particular, it appears that Windows takes a short time to free the socket after it is closed,

[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-04-30 Thread Paul Moore
Changes by Paul Moore p.f.mo...@gmail.com: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8576 ___ ___ Python-bugs-list mailing

[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-04-30 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +brian.curtin, exarkun, tim.golden type: - behavior versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8576

[issue7584] datetime.rfcformat() for Date and Time on the Internet

2010-04-30 Thread anatoly techtonik
anatoly techtonik techto...@gmail.com added the comment: The point is that your implementation doesn't allow people to generate 'Z'-ending timestamp if they need a subset of rfc3339. -- ___ Python tracker rep...@bugs.python.org

[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Ronald Oussoren
New submission from Ronald Oussoren ronaldousso...@mac.com: When I build the trunk with srcdir != builddir test_distutils fails when running tests. To reproduce: * Create a checkout of the trunk and chdir into this * mkdir build * cd build * ../configure * make test This results in a failure

[issue4180] warnings.simplefilter(always) does not make warnings always show up

2010-04-30 Thread Tres Seaver
Tres Seaver tsea...@agendaless.com added the comment: This patch tidies up the FilterWarnings tests to nomalize use of 'self.assertEquals' (matching the rest of the module) and make the 'test_always' assertions meaningful. -- Added file:

[issue4180] warnings.simplefilter(always) does not make warnings always show up

2010-04-30 Thread Tres Seaver
Tres Seaver tsea...@agendaless.com added the comment: This patch adds tests for the 'error', 'ignore', and 'always' filters being applied *after* the default warning has been issued, and therefore the registry populated. It causes failures for the 'error' and 'always' on both the Python and

[issue4180] warnings.simplefilter(always) does not make warnings always show up

2010-04-30 Thread Tres Seaver
Tres Seaver tsea...@agendaless.com added the comment: This patch replaces my earlier 'py_warnings' patch. It revamps the Python side to check filters before deciding not to emit the warning based on the registry. The new filter_after_default tests pass on the Python side with this patch.

[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Tarek Ziadé
Tarek Ziadé ziade.ta...@gmail.com added the comment: distutils.sysconfig.get_python_inc() uses os.path.dirname(os.path.abspath(sys.executable)) to find the srcdir. I'll change it to sysconfig.get_config_var('srcdir') -- ___ Python tracker

[issue3646] MacOS X framework install to non-standard directory fails

2010-04-30 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: In r80647 (trunk) you can use configure --enable-framework=$HOME/Library/Frameworks to get the right situation: - Framework in ~/Library/Frameworks - Apps in ~/Applications/Python 2.7 - Command-line tools in ~/bin I will port this to

[issue8577] test_distutils fails if srcdir != builddir

2010-04-30 Thread Tarek Ziadé
Tarek Ziadé ziade.ta...@gmail.com added the comment: Mmm, the problem is that srcdir is given by the Makefile. So I need to find the Makefile. I don't know how to get these info from a python built in another directory. Investigating... -- ___

  1   2   >