Find & Replace hyperlinks in a string

2007-11-26 Thread Nico Grubert
Hi there, I have a string containing some hyperlinks. I'd like to replace every hyperlink with a HTML style link. Example: Replace 'http://www.foo.com/any_url' with 'http://www.foo.com/any_url";>http://www.foo.com/any_url' What's the best way to do this if I have a few hundret s

Re: better way to write this function

2007-11-26 Thread Peter Otten
Ricardo Aráoz wrote: > Peter Otten wrote: >> You can use slicing: >> > def chunks(items, n): >> ... return [items[start:start+n] for n in range(0, len(items)-n+1, n)] >> ... > for i in range(1,10): >> ... print chunks(range(5), i) >> ... >> [[0], [1], [2], [3], [4]] >> [[0, 1],

Re: How to Teach Python "Variables"

2007-11-26 Thread greg
Hrvoje Niksic wrote: > A C programmer > told that Python variables internally hold pointers expects this code: > > def func(a): > a = 10 > ... > func(x) > > to change the value of x. He shouldn't expect that, because that's not what the equivalent code would do in C. To get that effect in C, y

Re: how to change current working directory while using pdb within emacs

2007-11-26 Thread R. Bernstein
duyanning <[EMAIL PROTECTED]> writes: > I have written a pyhton script that will process data file in current > working directory. > My script is in an different directory to data file. > When I debug this script using pdb within emacs, emacs will change the > current working directory to the dire

Re: spawning a process with subprocess

2007-11-26 Thread MonkeeSage
Hi Brian, Couple of things. You should use poll() on the Popen instance, and should check it explicitly against None (since a 0 return code, meaning exit successfully, will be treated as a false condition the same as None). Also, in your second example, you block the program when you call readline

Re: C pointer representation in python

2007-11-26 Thread abarun22
HI Thanks for the suggestion and i believe that seems a good idea. But because of some work related constraints i have to use SWIG for the moment. Regards Arun Terry Reedy wrote: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | Hi > | I am new to SWIG and python. I have a proble

Re: can any one tell me where to get graphics module in windows?

2007-11-26 Thread Paul McGuire
On Nov 26, 11:49 pm, evilcraft_mj <[EMAIL PROTECTED]> wrote: > when i type > from graphics import * > > error shown that there is no such module called graphics. > > help me find this.. Googling for "python graphics module" turns up this link: http://mcsp.wartburg.edu/zelle/python/graphics/gra

can any one tell me where to get graphics module in windows?

2007-11-26 Thread evilcraft_mj
when i type from graphics import * error shown that there is no such module called graphics. help me find this.. -- http://mail.python.org/mailman/listinfo/python-list

**********Hi Fashion lovers*********************

2007-11-26 Thread MayaKannaGi
**Hi Fashion lovers* http://ghjomy.50webs.com/ http://bigchurch.com/go/g914309-pmem http://indianfriendfinder.com/go/g914309-pmem -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Teach Python "Variables"

2007-11-26 Thread [EMAIL PROTECTED]
Chris Mellon wrote: > On Nov 26, 2007 1:21 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hrvoje Niksic wrote: > > > greg <[EMAIL PROTECTED]> writes: > > > > > > > none wrote: > > > >> IIRC, I once saw an explanation how Python doesn't have > > > >> "variables" in the sense that, say, C d

Re: Installing Python 3000 on Leopard (Mac OS) fails...

2007-11-26 Thread Martin v. Löwis
> gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused- > madd -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include - > DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o > ./Modules/posixmodule.c: In function 'posix_setpgrp': > ./Modules/posixmodule.c:3769:

Re: Need to call functions/class_methods etc using string ref :How

2007-11-26 Thread George Sakkis
On Nov 26, 2:04 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Donn Ingle a écrit : > > >>I see someone already showed you eval. Eval is evil. Don't use it. > >>Especially if the functions are coming to you from a public URL! > > > Yes, I suggested to him (by email) this: > > > thisinstanc

Re: Installing Python 3000 on Leopard (Mac OS) fails...

2007-11-26 Thread Robin Kåveland Hansen
"=?ISO-8859-1?Q?Andr=E9?=" <[EMAIL PROTECTED]> wrote (Mon, 26 Nov 2007 17:59:21 -0800): > While I made some progress in trying to install Py3k from source (for > the first time), it has failed... > > Here are the steps I went through (not necessarily in that order - > except for those that matter

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-26 Thread Steven D'Aprano
On Sun, 25 Nov 2007 02:42:36 -0800, Licheng Fang wrote: > I mentioned trigram counting as an illustrative case. In fact, you'll > often need to define patterns more complex than that, and tens of > megabytes of text may generate millions of them, and I've observed they > quickly ate up the 8G mem

Re: Installing Python 3000 on Leopard (Mac OS) fails...

2007-11-26 Thread André
On Nov 26, 9:59 pm, "André" <[EMAIL PROTECTED]> wrote: > While I made some progress in trying to install Py3k from source (for > the first time), it has failed... > > Here are the steps I went through (not necessarily in that order - > except for those that matter). > > 1. After installing Leopard,

Re: fork/exec with input redirection

2007-11-26 Thread hdante
On Nov 27, 12:09 am, hdante <[EMAIL PROTECTED]> wrote: > On Nov 26, 7:58 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: > > > > > I have a Python script that does a fork/exec, so the parent process > > can get the child's PID and monitor /proc/PID/stat (on a CentOS > > system). Most of my processes' c

Re: fork/exec with input redirection

2007-11-26 Thread hdante
On Nov 26, 7:58 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote: > I have a Python script that does a fork/exec, so the parent process > can get the child's PID and monitor /proc/PID/stat (on a CentOS > system). Most of my processes' command lines are straightforward > enough to do this with, but I have

Installing Python 3000 on Leopard (Mac OS) fails...

2007-11-26 Thread André
While I made some progress in trying to install Py3k from source (for the first time), it has failed... Here are the steps I went through (not necessarily in that order - except for those that matter). 1. After installing Leopard, install Xcode tools from the dvd - even if you had done so with a

Re: Installing Python 3000

2007-11-26 Thread André
[huge snip] > > This is on a Macbook with Leopard installed. > > I tried compiling a simple c program (hello world), something that I > have not done in *years* and it failed. It appears as though gcc has > a problem :-( > > I can create an object file (via gcc -c he

Re: Installing Python 3000

2007-11-26 Thread André
On Nov 26, 6:18 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > I'd like to install Python 3000 on my computers (Mac, and possibly > > Windows), without messing up the existing versions. So far, I've > > always relied on using ".msi" on Windows and ".dmg" on the Mac. > > > From the Python sit

Re: Rss Feed Creator

2007-11-26 Thread James Matthews
Is there any where you do not have us tidy? On Nov 27, 2007 2:03 AM, Shane Geiger <[EMAIL PROTECTED]> wrote: > I think this is what you need to make the output readable: > > tidy -asxml output.xml > > > > > > James Matthews wrote: > > Thank You Shane, > > > > However that is using PyRss2Gen which

Re: Rss Feed Creator

2007-11-26 Thread Shane Geiger
I think this is what you need to make the output readable: tidy -asxml output.xml James Matthews wrote: > Thank You Shane, > > However that is using PyRss2Gen which doesn't put newlines in the XML. > So it's a little out of the picture! > On Nov 27, 2007 1:57 AM, Shane Geiger < [EMAIL PROTECT

Re: Rss Feed Creator

2007-11-26 Thread James Matthews
Thank You Shane, However that is using PyRss2Gen which doesn't put newlines in the XML. So it's a little out of the picture! On Nov 27, 2007 1:57 AM, Shane Geiger <[EMAIL PROTECTED]> wrote: > http://www.bigbold.com/snippets/tag/beautifulsoup > > > > James Matthews wrote: > > Hi, > > > > I am look

Re: Rss Feed Creator

2007-11-26 Thread Shane Geiger
http://www.bigbold.com/snippets/tag/beautifulsoup James Matthews wrote: > Hi, > > I am looking for a library that will create Rss/Atom feeds in python. > It needs to format the XML in a readable format! Does anyone have any > suggestions? > > Thanks James > > > -- > http://search.goldwatches.co

Rss Feed Creator

2007-11-26 Thread James Matthews
Hi, I am looking for a library that will create Rss/Atom feeds in python. It needs to format the XML in a readable format! Does anyone have any suggestions? Thanks James -- http://search.goldwatches.com/?Search=Movado+Watches http://www.goldwatches.com/coupons http://www.jewelerslounge.com --

Re: Add speller to Python application

2007-11-26 Thread helzer
Hi Jarek and Shane, This is just what I need. Thanks, Helzer -- http://mail.python.org/mailman/listinfo/python-list

trouble selling twisted

2007-11-26 Thread sndive
i have a lot of trouble selling twisted a a client lib for network access (on embedded platform) the group i'm a member of wants to write some unmaintainable threaded blocking junk in c--. does anyone can give me an idea how many kilobytes extra would it take to have a pyqt linked in and a running

Re: better way to write this function

2007-11-26 Thread Ricardo Aráoz
Peter Otten wrote: > Kelie wrote: > >> Hello, >> >> This function does I what I want. But I'm wondering if there is an >> easier/better way. To be honest, I don't have a good understanding of >> what "pythonic" means yet. >> >> def divide_list(lst, n): >> """Divide a list into a number of list

Re: Should proxy objects lie about their class name?

2007-11-26 Thread Carl Banks
On Nov 20, 3:50 pm, [EMAIL PROTECTED] (John J. Lee) wrote: > Not much to add to the subject line. I mean something like this: > > ProxyClass.__name__ = ProxiedClass.__name__ > > I've been told that this is common practice. Is it? Would this > surprise you if you ran into it in a debugging sessio

Re: Best ways of managing text encodings in source/regexes?

2007-11-26 Thread tinkerbarbet
On Nov 27, 12:27 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > * When I say "# -*- coding: utf-8 -*-" and confirm my IDE is saving > > the source file as UTF-8, do I still need to prefix all the strings > > constructed in the source with u as in myStr = u"blah", even when > > those strings c

Re: Best ways of managing text encodings in source/regexes?

2007-11-26 Thread Martin v. Löwis
> * When I say "# -*- coding: utf-8 -*-" and confirm my IDE is saving > the source file as UTF-8, do I still need to prefix all the strings > constructed in the source with u as in myStr = u"blah", even when > those strings contain only ASCII or ISO-8859-1 chars? (It would be a > bother for me to

Re: How to Teach Python "Variables"

2007-11-26 Thread Steven D'Aprano
On Mon, 26 Nov 2007 21:37:19 +1300, greg wrote: > none wrote: >> IIRC, I once saw an explanation how Python doesn't have "variables" >> in the sense that, say, C does, and instead has bindings from names to >> objects. > > If you're talking to C programmers, just tell them that Python variabl

Re: Installing Python 3000

2007-11-26 Thread Martin v. Löwis
> I'd like to install Python 3000 on my computers (Mac, and possibly > Windows), without messing up the existing versions. So far, I've > always relied on using ".msi" on Windows and ".dmg" on the Mac. > > From the Python site, I read (different version, but still...): > > Unpack the archive

Re: fork/exec with input redirection

2007-11-26 Thread Erik Jones
On Nov 26, 2007, at 3:58 PM, Dan Upton wrote: > I have a Python script that does a fork/exec, so the parent process > can get the child's PID and monitor /proc/PID/stat (on a CentOS > system). Most of my processes' command lines are straightforward > enough to do this with, but I have a handful t

Re: Installing Python 3000

2007-11-26 Thread Peter Otten
André wrote: > The step that gets me worried is the "make install" one... I don't want it > to take over as default. I would like to be able to invoke it by typing > "python3k ..." from anywhere and have it work - while still having > "python" invoke the default 2.5 version. You want make altin

fork/exec with input redirection

2007-11-26 Thread Dan Upton
I have a Python script that does a fork/exec, so the parent process can get the child's PID and monitor /proc/PID/stat (on a CentOS system). Most of my processes' command lines are straightforward enough to do this with, but I have a handful that use < on the command line, eg ./gobmk_base.linux_x

Re: How to Teach Python "Variables"

2007-11-26 Thread jkn
On Nov 25, 10:36 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > > In addition to the good answers you've had already, I highly recommend > David Goodger's "Code like a Pythonista" page > http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html>, > which contains a very good "cardboard box

Installing Python 3000

2007-11-26 Thread André
Sorry about the simple question ... I'd like to install Python 3000 on my computers (Mac, and possibly Windows), without messing up the existing versions. So far, I've always relied on using ".msi" on Windows and ".dmg" on the Mac. >From the Python site, I read (different version, but still...):

Re: better way to write this function

2007-11-26 Thread Arnaud Delobelle
On Nov 26, 8:19 am, Peter Otten <[EMAIL PROTECTED]> wrote: [...] > > Or build a generator that works with arbitrary iterables: > > >>> from itertools import * > >>> def chunks(items, n): > > ... items = iter(items) > ... while 1: > ... chunk = list(islice(items, n-1)) > ...

Re: the annoying, verbose self

2007-11-26 Thread Colin J. Williams
Bruno Desthuilliers wrote: [snip]> > Too bad : in Python, everything's an object, so 'methods' are attributes > too. What do you see as a problem here? Surely it gives useful flexibility. Colin W. -- http://mail.python.org/mailman/listinfo/python-list

Re: basic if stuff- testing ranges

2007-11-26 Thread John Machin
On Nov 27, 3:01 am, Erik Jones <[EMAIL PROTECTED]> wrote: > On Nov 25, 2007, at 9:49 PM, Donn Ingle wrote: > > > > >>> if 0 > x < 20: print "within" > >> That means "if x LESS THAN 0 and x < 20". > > Oh, bugger. It's tricky. > >> So try > >> if 0 < x < 20: > > Thanks. I was flipping signs in my

Re: spawning a process with subprocess

2007-11-26 Thread bhunter
On Nov 26, 3:05 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > bhunter schrieb: > > > > > On Nov 26, 1:50 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> bhunter schrieb: > > >>> Hi, > >>> I've used subprocess with 2.4 several times to execute a process, wait > >>> for it to finish, and

gnosis XML objectify

2007-11-26 Thread Wang, Harry
Problem solved. I left out a right closing tag (">") in the XML, but I am having another problem. Harry C. Wang Sr. Test Engineer (Automation) AOL Mobile Phone 206 - 268 - 7502 temporary e-mail: [EMAIL PROTECTED] Personal e-mail: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listi

Re: gnosis XML objectify

2007-11-26 Thread kyosohma
On Nov 26, 2:33 pm, "Wang, Harry" <[EMAIL PROTECTED]> wrote: > Full Traceback enclosed: > > Test Suite Started @ 2007-11-26 11:34:46.617000 > Traceback (most recent call last): > File "C:\UDR2\UDRxmlGateway.py", line 370, in > ParseAll() > File "C:\UDR2\UDRxmlGateway.py", line 286, in Pars

Re: the annoying, verbose self

2007-11-26 Thread Ton van Vliet
On Mon, 26 Nov 2007 20:14:50 +0100, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >> However, I was more thinking in terms of attributes only > >Too bad : in Python, everything's an object, so 'methods' are attributes >too. Right, but I'm sure *you* know a way to distinguish between them (I'm j

RE: gnosis XML objectify

2007-11-26 Thread Wang, Harry
I can't tell where in the XML file it throws the error. Here is the snippet of the Python code: def ParseAll(): py_obj = gnosis.xml.objectify.XML_Objectify(InputFile).make_instance() Harry C. Wang Sr. Test Engineer (Automation) AOL Mobile Phone 206 - 268 - 7502 temporary e-mail: [EMAIL PROTE

Re: Need to call functions/class_methods etc using string ref :How

2007-11-26 Thread Bruno Desthuilliers
Donn Ingle a écrit : >>target = >>for funcname in funclist: >>func = getattr(target, funcname, None) >>if callable(func): >>func(*args, **kwargs) > > Nice. 'callable' is new to me. What about getattr, then ?-) And FWIW, callable will disappear in py3k... (anyway, you can just test if the objec

RE: gnosis XML objectify

2007-11-26 Thread Wang, Harry
Full Traceback enclosed: Test Suite Started @ 2007-11-26 11:34:46.617000 Traceback (most recent call last): File "C:\UDR2\UDRxmlGateway.py", line 370, in ParseAll() File "C:\UDR2\UDRxmlGateway.py", line 286, in ParseAll py_obj = gnosis.xml.objectify.XML_Objectify(InputFile).make_inst

Re: gnosis XML objectify

2007-11-26 Thread Sébastien Boisgérault
On Nov 26, 8:46 pm, "Wang, Harry" <[EMAIL PROTECTED]> wrote: > The gnosis xml libs should not be version specific, but when I try to use > Python 2.5, I am getting "not well formed (invalid token)" errors. > > Harry Could you show us a simple example that exhibits this behavior please ? SB -- h

Re: gnosis XML objectify

2007-11-26 Thread kyosohma
On Nov 26, 1:46 pm, "Wang, Harry" <[EMAIL PROTECTED]> wrote: > The gnosis xml libs should not be version specific, but when I try to use > Python 2.5, I am getting "not well formed (invalid token)" errors. > > Harry When does this happen? When you import the module? When you pass it some xml? Do

Re: Need to call functions/class_methods etc using string ref :How

2007-11-26 Thread Donn Ingle
> target = > for funcname in funclist: > func = getattr(target, funcname, None) > if callable(func): > func(*args, **kwargs) Nice. 'callable' is new to me. Live and learn :) \d -- http://mail.python.org/mailman/listinfo/python-list

Re: spawning a process with subprocess

2007-11-26 Thread Diez B. Roggisch
bhunter schrieb: > On Nov 26, 1:50 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> bhunter schrieb: >> >> >> >>> Hi, >>> I've used subprocess with 2.4 several times to execute a process, wait >>> for it to finish, and then look at its output. Now I want to spawn >>> the process separately, la

Re: C pointer representation in python

2007-11-26 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hi | I am new to SWIG and python. I have a problem while trying to call a C | function from Python using SWIG as an interface. Did you consider using the ctypes module? (It is new in the stdlib for 2.5, I believe.) Some consider it ea

gnosis XML objectify

2007-11-26 Thread Wang, Harry
The gnosis xml libs should not be version specific, but when I try to use Python 2.5, I am getting "not well formed (invalid token)" errors. Harry -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Teach Python "Variables"

2007-11-26 Thread Chris Mellon
On Nov 26, 2007 1:21 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hrvoje Niksic wrote: > > greg <[EMAIL PROTECTED]> writes: > > > > > none wrote: > > >> IIRC, I once saw an explanation how Python doesn't have > > >> "variables" in the sense that, say, C does, and instead has bindings > >

Best ways of managing text encodings in source/regexes?

2007-11-26 Thread tinkerbarbet
Hi I've read around quite a bit about Unicode and python's support for it, and I'm still unclear about how it all fits together in certain scenarios. Can anyone help clarify? * When I say "# -*- coding: utf-8 -*-" and confirm my IDE is saving the source file as UTF-8, do I still need to prefix a

Re: spawning a process with subprocess

2007-11-26 Thread bhunter
On Nov 26, 1:50 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > bhunter schrieb: > > > > > Hi, > > > I've used subprocess with 2.4 several times to execute a process, wait > > for it to finish, and then look at its output. Now I want to spawn > > the process separately, later check to see if i

Re: better way to write this function

2007-11-26 Thread Peter Otten
Peter Otten wrote: def chunks(items, n): > ... return [items[start:start+n] for n in range(0, len(items)-n+1, n)] Ouch, this should be def chunks(items, n): return [items[start:start+n] for start in range(0, len(items)-n+1, n)] Peter -- http://mail.python.org/mailman/listinfo/py

Re: spawning a process with subprocess

2007-11-26 Thread bhunter
> > This is just the way I do it...as I said, there are probably some > other people in the group who will have other opinions. By the way, > your statement "I was hoping not to have to avoid that" means that you > hoped to use threading...which I think is contradictory to what you > meant. > > Mik

Re: the annoying, verbose self

2007-11-26 Thread Bruno Desthuilliers
samwyse a écrit : (snip) > > Actually, the chained dots are solving a completely different problem, > that of refactoring a collection of functions that use global vars > into a class. Using globals to maintain state between functions being bad practice in most cases, I don't see any reason to e

Re: the annoying, verbose self

2007-11-26 Thread Bruno Desthuilliers
Patrick Mullen a écrit : (snip) > Still an unnecessary lookup on tmp though :) And it would be useless > to use it for one assignment, the idea is to eliminate all the typing > with this: > > self.var1 = 5 > self.var2 = "a value" > self.var3 = stuff > self.var4 = [2,54,7,7] > self.var5 = "dingali

Re: How to Teach Python "Variables"

2007-11-26 Thread [EMAIL PROTECTED]
Hrvoje Niksic wrote: > greg <[EMAIL PROTECTED]> writes: > > > none wrote: > >> IIRC, I once saw an explanation how Python doesn't have > >> "variables" in the sense that, say, C does, and instead has bindings > >> from names to objects. > > IMHO, this is nonsense. All that variables are (in a

Re: the annoying, verbose self

2007-11-26 Thread Bruno Desthuilliers
Ton van Vliet a écrit : > On 24 Nov 2007 16:07:18 GMT, Duncan Booth > <[EMAIL PROTECTED]> wrote: > > >>Ton van Vliet <[EMAIL PROTECTED]> wrote: >> >> >>>It would boil down to choice: explicit/speed vs implicit/readability >> >>No, it would boil down to explicit+speed+readability+maintainability v

Re: the annoying, verbose self

2007-11-26 Thread Bruno Desthuilliers
samwyse a écrit : (snip) > > Besides Pascal, Visual Basic also offers a 'with' statement that > behaves almost in this way. That in itself should be an indication > that the whole thing is a bad idea. ;-) FWIW, Javascript has it too - and it's considered a BadPractice(tm) to use it... -- http

Re: the annoying, verbose self

2007-11-26 Thread Bruno Desthuilliers
Ton van Vliet a écrit : > On 24 Nov 2007 13:56:37 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> > wrote: (snip) >>So:: >> >> def meth(self): >> using self: >> tmp = raw_input('Enter age: ') >> age = int(tmp) >> >>becomes:: >> >> def meth(self): >> using self:

Re: better way to write this function

2007-11-26 Thread Paul Hankin
On Nov 26, 7:42 am, Kelie <[EMAIL PROTECTED]> wrote: > Hello, > > This function does I what I want. But I'm wondering if there is an > easier/better way. To be honest, I don't have a good understanding of > what "pythonic" means yet. > > def divide_list(lst, n): > """Divide a list into a number

Re: Need to call functions/class_methods etc using string ref :How

2007-11-26 Thread Bruno Desthuilliers
Donn Ingle a écrit : >>I see someone already showed you eval. Eval is evil. Don't use it. >>Especially if the functions are coming to you from a public URL! > > Yes, I suggested to him (by email) this: > > thisinstance = SomeObject.__class__.__dict__ > This will only get attributes defined

Re: Should proxy objects lie about their class name?

2007-11-26 Thread Diez B. Roggisch
John J. Lee schrieb: > [EMAIL PROTECTED] (John J. Lee) writes: > >> Not much to add to the subject line. I mean something like this: >> >> ProxyClass.__name__ = ProxiedClass.__name__ >> >> >> I've been told that this is common practice. Is it? Would this >> surprise you if you ran into it in a

Re: spawning a process with subprocess

2007-11-26 Thread Diez B. Roggisch
bhunter schrieb: > Hi, > > I've used subprocess with 2.4 several times to execute a process, wait > for it to finish, and then look at its output. Now I want to spawn > the process separately, later check to see if it's finished, and if it > is look at its output. I may want to send a signal at

Re: spawning a process with subprocess

2007-11-26 Thread kyosohma
On Nov 26, 12:27 pm, bhunter <[EMAIL PROTECTED]> wrote: > > I've read that this sort of thing can be a pain. I'm sure someone will > > post and have other views though. I have had some success using > > Python's threading module though. There's a pretty good walkthrough > > here (it uses wxPython i

Re: Tk 8.5

2007-11-26 Thread James Matthews
I also cannot wait! On Nov 24, 2007 4:12 PM, Ron Provost <[EMAIL PROTECTED]> wrote: > Hello, > > According to the tk wiki, the final release of Tcl/Tk is just weeks away > (see http://wiki.tcl.tk/12753). Does anyone know if the Tk enhancements > will be in Python 2.6? Since I don't use tk but

Re: How to write Regular Expression for recursive matching?

2007-11-26 Thread lisong
On Nov 26, 12:34 pm, "J. Clifford Dyer" <[EMAIL PROTECTED]> wrote: > On Mon, Nov 26, 2007 at 06:04:54PM +0100, Diez B. Roggisch wrote regarding > Re: How to write Regular Expression for recursive matching?: > > > > > > > lisong wrote: > > > > Hi All, > > > > I have problem to split a string like t

Re: spawning a process with subprocess

2007-11-26 Thread bhunter
> I've read that this sort of thing can be a pain. I'm sure someone will > post and have other views though. I have had some success using > Python's threading module though. There's a pretty good walkthrough > here (it uses wxPython in its example): > > http://wiki.wxpython.org/LongRunningTasks >

Re: How to write Regular Expression for recursive matching?

2007-11-26 Thread J. Clifford Dyer
On Mon, Nov 26, 2007 at 06:04:54PM +0100, Diez B. Roggisch wrote regarding Re: How to write Regular Expression for recursive matching?: > > lisong wrote: > > > Hi All, > > > > I have problem to split a string like this: > > > > 'abc.defg.hij.klmnop' > > > > and I want to get all substrings wi

Re: How to write Regular Expression for recursive matching?

2007-11-26 Thread Boris Borcic
lisong wrote: > Hi All, > > I have problem to split a string like this: > > 'abc.defg.hij.klmnop' > > and I want to get all substrings with only one '.' in mid. so the > output I expect is : > > 'abc.defg', 'defg.hij', 'hij.klmnop' > > a simple regular expression '\w+.\w' will only return: > '

Re: How to write Regular Expression for recursive matching?

2007-11-26 Thread Paul McGuire
On Nov 26, 10:51 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Nov 26, 10:40 am, lisong <[EMAIL PROTECTED]> wrote: > > > > > > > Hi All, > > > I have problem to split a string like this: > > > 'abc.defg.hij.klmnop' > > > and I want to get all substrings with only one '.' in mid. so the > > outpu

Re: better way to write this function

2007-11-26 Thread Paul McGuire
On Nov 26, 1:42 am, Kelie <[EMAIL PROTECTED]> wrote: > Hello, > > This function does I what I want. But I'm wondering if there is an > easier/better way. To be honest, I don't have a good understanding of > what "pythonic" means yet. > > def divide_list(lst, n): > """Divide a list into a number

Re: Should proxy objects lie about their class name?

2007-11-26 Thread John J. Lee
[EMAIL PROTECTED] (John J. Lee) writes: > Not much to add to the subject line. I mean something like this: > > ProxyClass.__name__ = ProxiedClass.__name__ > > > I've been told that this is common practice. Is it? Would this > surprise you if you ran into it in a debugging session? Does nobody

Re: spawning a process with subprocess

2007-11-26 Thread kyosohma
On Nov 26, 10:54 am, bhunter <[EMAIL PROTECTED]> wrote: > Hi, > > I've used subprocess with 2.4 several times to execute a process, wait > for it to finish, and then look at its output. Now I want to spawn > the process separately, later check to see if it's finished, and if it > is look at its ou

Re: How to write Regular Expression for recursive matching?

2007-11-26 Thread Diez B. Roggisch
lisong wrote: > Hi All, > > I have problem to split a string like this: > > 'abc.defg.hij.klmnop' > > and I want to get all substrings with only one '.' in mid. so the > output I expect is : > > 'abc.defg', 'defg.hij', 'hij.klmnop' > > a simple regular expression '\w+.\w' will only return: >

spawning a process with subprocess

2007-11-26 Thread bhunter
Hi, I've used subprocess with 2.4 several times to execute a process, wait for it to finish, and then look at its output. Now I want to spawn the process separately, later check to see if it's finished, and if it is look at its output. I may want to send a signal at some point to kill the proces

Re: How to write Regular Expression for recursive matching?

2007-11-26 Thread Paul McGuire
On Nov 26, 10:40 am, lisong <[EMAIL PROTECTED]> wrote: > Hi All, > > I have problem to split a string like this: > > 'abc.defg.hij.klmnop' > > and I want to get all substrings with only one '.' in mid. so the > output I expect is : > > 'abc.defg', 'defg.hij', 'hij.klmnop' > > a simple regular expre

Re: win32serviceutil won't start

2007-11-26 Thread kyosohma
On Nov 25, 5:11 pm, Nikola Skoric <[EMAIL PROTECTED]> wrote: > Dana Sun, 25 Nov 2007 13:52:35 -0800 (PST), > [EMAIL PROTECTED] <[EMAIL PROTECTED]> kaze: > > > Looks like Microsoft thinks you mis-spelled it. > > >http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/w... > > > I would

Re: better way to write this function

2007-11-26 Thread Chris Mellon
On Nov 26, 2007 3:24 AM, Paul Rudin <[EMAIL PROTECTED]> wrote: > Kelie <[EMAIL PROTECTED]> writes: > > > Hello, > > > > This function does I what I want. But I'm wondering if there is an > > easier/better way. To be honest, I don't have a good understanding of > > what "pythonic" means yet. > > > >

Re: eof

2007-11-26 Thread Boris Borcic
ZeD wrote: > Grant Edwards wrote: > >> The user-defined xor is operates on "logical" boolean values. >> The one in the operator module is a bitwise operator. > > def xor(a, b): > return bool(a) ^ bool(b) > > seems more explicit to me. > maybe, to make "more" explicit (too much, onestly...) >

How to write Regular Expression for recursive matching?

2007-11-26 Thread lisong
Hi All, I have problem to split a string like this: 'abc.defg.hij.klmnop' and I want to get all substrings with only one '.' in mid. so the output I expect is : 'abc.defg', 'defg.hij', 'hij.klmnop' a simple regular expression '\w+.\w' will only return: 'abc.defg', 'hij.klmnop' is there a way

Re: better way to write this function

2007-11-26 Thread Kelie
On Nov 25, 11:24 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: > See the last recipe from:http://docs.python.org/lib/itertools-recipes.html. > It's not doing > quite the same thing, but gives an illustration of one way to approach > this sort of thing. Thanks for the link! -- http://mail.python.or

Re: Installing modules via setuptools in a script

2007-11-26 Thread Robert Kern
Thorsten Kampe wrote: > * Robert Kern (Mon, 26 Nov 2007 04:34:17 -0600) >> Thorsten Kampe wrote: >>> * Robert Kern (Sat, 24 Nov 2007 16:33:37 -0600) Thorsten Kampe wrote: > can anyone give me a short code snippet how to install a missing > module via setuptools (assuming setuptools is

Re: better way to write this function

2007-11-26 Thread Kelie
On Nov 25, 10:51 pm, Paul Rubin wrote: > Really though, this grouping function gets reimplemented so often that > it should be built into the stdlib, maybe in itertools. thanks Paul. itertools? that was actually the first module i checked. -- http://mail.python.org/mail

Re: mod_python

2007-11-26 Thread Aaron Watters
On Nov 24, 1:19 am, Vernon Wenberg III <[EMAIL PROTECTED]> wrote: > Why do I receive a "File not found" error on a perfect good and simple > script but properly receive errors when I deliberately add errors in the > script? The file is there, it just doesn't do anything. > > Any help would be appre

Re: Need to call functions/class_methods etc using string ref :How

2007-11-26 Thread Donn Ingle
> I see someone already showed you eval.  Eval is evil.  Don't use it. > Especially if the functions are coming to you from a public URL! Yes, I suggested to him (by email) this: thisinstance =  SomeObject.__class__.__dict__ for f in yourlist:  if f in thisinstance: eval(f)(params) Which would

Re: eof

2007-11-26 Thread ZeD
Grant Edwards wrote: > The user-defined xor is operates on "logical" boolean values. > The one in the operator module is a bitwise operator. def xor(a, b): return bool(a) ^ bool(b) seems more explicit to me. maybe, to make "more" explicit (too much, onestly...) from operator import xor as b

Re: Code Management

2007-11-26 Thread Sergio Correia
Bluebird: If you are using python 2.5, relative imports are no longer an issue: http://docs.python.org/whatsnew/pep-328.html That problem solved, what you sometimes want is to change the version of your package. I just change the text in the PTH file, to point to another version, and voilá (no ne

Re: basic if stuff- testing ranges

2007-11-26 Thread Erik Jones
On Nov 26, 2007, at 2:29 AM, Peter Otten wrote: > Donn Ingle wrote: > >>> x in range(1,20) ? >> Sure, that's okay, but it has clarity issues, and is calling a func. > > and it requires that x is integral (1.0 is in the range, 1.001 is > not), > and becomes dog slow when the range gets larger. No

Re: Running unmodified CGI scripts persistently under mod_wsgi.

2007-11-26 Thread Jeffrey Froman
Graham Dumpleton wrote: > The other question is whether there is even a demand for this. Do > people want to be able to take unmodified Python CGI scripts and try > to run them persistently in this way, or would they be better off > converting them to proper WSGI applications. I would personally

Re: eof

2007-11-26 Thread Grant Edwards
On 2007-11-26, Boris Borcic <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> def xor(a, b): >> return a and not b or b and not a > > > >>> from operator import xor > >>> help(xor) > Help on built-in function xor in module operator: > > xor(...) > xor(a, b) -- Same as a ^ b. Which

Re: basic if stuff- testing ranges

2007-11-26 Thread Erik Jones
On Nov 25, 2007, at 9:49 PM, Donn Ingle wrote: >>> if 0 > x < 20: print "within" >> That means "if x LESS THAN 0 and x < 20". > Oh, bugger. It's tricky. >> So try >> if 0 < x < 20: > Thanks. I was flipping signs in my tests, but I guess I flipped > both and got > myself all confused. > >> L

Re: Need to call functions/class_methods etc using string ref :How

2007-11-26 Thread J. Clifford Dyer
On Mon, Nov 26, 2007 at 04:07:03PM +0530, Ravi Kumar wrote regarding Need to call functions/class_methods etc using string ref :How: > >Hi, >First of all, since this is my first mail to Python-List, I want to say >"Hello world!" >After that; >I am stuck in a project. Actually

Re: eof

2007-11-26 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > def xor(a, b): > return a and not b or b and not a >>> from operator import xor >>> help(xor) Help on built-in function xor in module operator: xor(...) xor(a, b) -- Same as a ^ b. -- http://mail.python.org/mailman/listinfo/python-list

Re: Handling Menubars in WXGlade

2007-11-26 Thread kyosohma
On Nov 23, 7:57 am, "jatin patni" <[EMAIL PROTECTED]> wrote: > Hi, I recently started working on WXGlade... > > I found some amount of documentation online > > I am having problems integrating event handlers with MenubarsI > want each menu item to open a new window with custom made > contro

  1   2   >