Re: String handling and the percent operator

2006-07-13 Thread Tom Plunket
Simon Forman wrote: > strings have a count() method. thanks! For enrichment purposes, is there a way to do this sort of thing with a generator? E.g. something like: def SentenceGenerator(): words = ['I', 'have', 'been', 'to', 'the', 'fair'] for w in words: yield w message = "%s %

Re: What is a type error?

2006-07-13 Thread Marshall
Chris Smith wrote: > Darren New <[EMAIL PROTECTED]> wrote: > > Chris Smith wrote: > > > Unless I'm missing your point, I disagree with your disagreement. > > > Mutability only makes sense because of object identity (in the generic > > > sense; no OO going on here). > > > > Depends what you mean by

Problem Solved

2006-07-13 Thread dylpkls91
Thank you all for your responses. I have managed to figure out a solution using XML RPC which fits my needs perfectly. -- http://mail.python.org/mailman/listinfo/python-list

Re: String handling and the percent operator

2006-07-13 Thread Erik Max Francis
Tom Plunket wrote: > For enrichment purposes, is there a way to do this sort of thing with > a generator? E.g. something like: > > def SentenceGenerator(): >words = ['I', 'have', 'been', 'to', 'the', 'fair'] >for w in words: > yield w > > message = "%s %s %s %s" > > print messag

attaching debugger to runinng python program

2006-07-13 Thread alf
Hi, I have a two fold question: -how to attach the debugger to running multi threaded program -the objective is to find an infinite loop in one of threads which makes the whole thingy going craze (100%CPU) The program itself is not easy, in fact quite hude and sometimes it takes

Re: Problem Solved

2006-07-13 Thread Gerhard Fiedler
On 2006-07-13 20:46:16, dylpkls91 wrote: > Thank you all for your responses. > > I have managed to figure out a solution using XML RPC which fits my > needs perfectly. BTW, if you want to test networking between two machines on one single (Windows) computer, try VirtualPC. (Free from MS.) Gerha

Re: String handling and the percent operator

2006-07-13 Thread Justin Azoff
Tom Plunket wrote: > boilerplate = \ > """ [big string] > """ > > return boilerplate % ((module,) * 3) > > My question is, I don't like hardcoding the number of times that the > module name should be repeated in the two return functions. Is there > an straight forward (inline-appropria

Re: What is a type error?

2006-07-13 Thread Chris Smith
Marshall <[EMAIL PROTECTED]> wrote: > Chris Smith wrote: > > Darren New <[EMAIL PROTECTED]> wrote: > > > Chris Smith wrote: > > > > Unless I'm missing your point, I disagree with your disagreement. > > > > Mutability only makes sense because of object identity (in the generic > > > > sense; no OO g

Re: Byte array question

2006-07-13 Thread Dan Winsor
Sybren Stuvel wrote: > Dan Winsor enlightened us with: > > This one "works" in that it runs, but the server on the other end gets > > garbage unrelated to the test file. > > Are you sure it is garbage? Have you tried changing byte order? Ah, that I hadn't. Any pointers to doing that? -- http:/

Re: Regular Expression problem

2006-07-13 Thread Justin Azoff
John Blogger wrote: > That I want a particular tag value of one of my HTML files. > > ie: I want only the value after 'href=' in the tag >> > > '' > > here it would be 'mystylesheet.css'. I used the following regex to get > this value(I dont know if it is good). No matter how good it is you should

Re: 3d simulation

2006-07-13 Thread Edmond Dantes
placid wrote: > > alimoe wrote: >> > Genetic Programming or Genetic Algorithms? >> >> whats the difference? > > > Genetic Programming: > is an automated methodology inspired by biological evolution to find > computer programs that best perform a user-defined task. > > http://en.wikipedia.org/w

Re: Regular Expression problem

2006-07-13 Thread Justin Azoff
Justin Azoff wrote: > >>> from BeautifulSoup import BeautifulSoup > >>> html='' > >>> page=BeautifulSoup(html) > >>> page.link.get('href') > 'mystylesheet.css' On second thought, you will probably want something like >>> [link.get('href') for link in page.fetch('link',{'type':'text/css'})] ['myst

Re: What is a type error?

2006-07-13 Thread David Hopwood
Chris Smith wrote: > David Hopwood <[EMAIL PROTECTED]> wrote: > >>This is true, but note that postconditions also need to be efficient >>if we are going to execute them. > > If checked by execution, yes. In which case, I am trying to get my head > around how it's any more true to say that funct

Re: String handling and the percent operator

2006-07-13 Thread Brett g Porter
Justin Azoff wrote: > Tom Plunket wrote: >> boilerplate = \ >> """ > [big string] >> """ >> >> return boilerplate % ((module,) * 3) >> [deletia...] > Of course.. > stuff = {'lang': 'python', 'page': 'typesseq-strings.html'} print """I should read the %(lang)s documentation at

Re: String handling and the percent operator

2006-07-13 Thread Simon Forman
Tom Plunket wrote: > Simon Forman wrote: > > > strings have a count() method. > > thanks! > > For enrichment purposes, is there a way to do this sort of thing with > a generator? E.g. something like: > > def SentenceGenerator(): >words = ['I', 'have', 'been', 'to', 'the', 'fair'] >for w in

Re: Byte array question

2006-07-13 Thread John Machin
On 14/07/2006 10:41 AM, Dan Winsor wrote: > Sybren Stuvel wrote: >> Dan Winsor enlightened us with: >>> This one "works" in that it runs, but the server on the other end gets >>> garbage unrelated to the test file. >> Are you sure it is garbage? Have you tried changing byte order? > > Ah, that I h

Re: testing array of logicals

2006-07-13 Thread Simon Forman
John Henry wrote: > Hi list, > > Is there a more elagant way of doing this? > > # logflags is an array of logicals > test=True > for x in logflags: >test = test and x > print test > > -- > Thanks, So many ways *drool* How about: False not in logflags (Anybody gonna run all these throu

Re: testing array of logicals

2006-07-13 Thread Simon Forman
> > False not in logflags > Or, if your values aren't already bools False not in (bool(n) for n in logflags) Peace, ~Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a type error?

2006-07-13 Thread Marshall
Chris Smith wrote: > Marshall <[EMAIL PROTECTED]> wrote: > > Chris Smith wrote: > > > Darren New <[EMAIL PROTECTED]> wrote: > > > > Chris Smith wrote: > > > > > Unless I'm missing your point, I disagree with your disagreement. > > > > > Mutability only makes sense because of object identity (in the

Re: 3d simulation

2006-07-13 Thread placid
Edmond Dantes wrote: > placid wrote: > > > > > alimoe wrote: > >> > Genetic Programming or Genetic Algorithms? > >> > >> whats the difference? > > > > > > Genetic Programming: > > is an automated methodology inspired by biological evolution to find > > computer programs that best perform a user-de

Re: testing array of logicals

2006-07-13 Thread John Henry
Simon Forman wrote: > > > > False not in logflags > > > > Or, if your values aren't already bools > > False not in (bool(n) for n in logflags) > > > > Peace, > ~Simon Very intriguing use of "not in"... Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: What is a type error?

2006-07-13 Thread Chris Smith
Marshall <[EMAIL PROTECTED]> wrote: > > What you are asking for is some subset of identity, and I've not yet > > succeeded in understanding exactly what it is or what its limits are... > > except that so far, it seems to have everything to do with pointers or > > aliasing. > > Perhaps it is specif

Configuring IDLE on Linux

2006-07-13 Thread Satya Kiran
Hello, I have upgraded to Python2.4 on my Red Hat 9.0 Linux box. I want to work with IDLE and ran a search to check it's presence. Here is what I get. [EMAIL PROTECTED] bin]# find / -iname idlelib /usr/local/lib/python2.4/idlelib [EMAIL PROTECTED] bin]# cd /usr/local/lib/python2.4/idlelib [EMAIL

Re: 3d simulation

2006-07-13 Thread Carl Banks
Edmond Dantes wrote: > I would tend to think that Lisp is more suited for Genetic Programming than > Python is. However, it is possible to do. Heck, I even had the crazy idea > of doing Genetic Programming in C++ once, however ugly that would've > been! > > Actually, there is an AI project that

Re: Configuring IDLE on Linux

2006-07-13 Thread Adonis
Satya Kiran wrote: > Hello, > I have upgraded to Python2.4 on my Red Hat 9.0 Linux box. > I want to work with IDLE and ran a search to check it's presence. > Here is what I get. > > [EMAIL PROTECTED] bin]# find / -iname idlelib > /usr/local/lib/python2.4/idlelib > > [EMAIL PROTECTED] bin]# cd /us

Re: Cool Ebooks Site

2006-07-13 Thread Michael P.
Hey, pretty impressive list. I downloaded a few myself. -- http://mail.python.org/mailman/listinfo/python-list

Re: Chunking sequential values in a list

2006-07-13 Thread skip
Gerard> David Hirschfield wrote: >> I have this function: >> >> def sequentialChunks(l, stride=1): ... >> >> Which takes a list of numerical values "l" and splits it into chunks >> where each chunk is sequential... Gerard> see the groupby example here: G

Re: Cool Ebooks Site

2006-07-13 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > Submit your comments because I need them! [loads of SPAM deleted] As I infer from the type of your posting, what you *want* is a good placement in Google, but what you really *need* is a good lawyer. Stefan -- http://mail.python.org/mailman/listinfo/python-list

TFTP client in python

2006-07-13 Thread malahal
Is there a TFTP client python module? I just need "get file" feature. I came across two implementations on WEB, but they are kind of unfinished (got the code from some mailing list!). Thanks, Malahal. -- http://mail.python.org/mailman/listinfo/python-list

Re: attaching debugger to runinng python program

2006-07-13 Thread Bill Pursell
alf wrote: > Hi, > > I have a two fold question: > -how to attach the debugger to running multi threaded program > -the objective is to find an infinite loop in one of threads which > makes the whole thingy going craze (100%CPU) > > The program itself is not easy, in fact quite hude an

Re: Line by line execution of python code

2006-07-13 Thread Stefan Behnel
Justin Powell wrote: > Hi, I'm looking for suggestions on how to accomplish something in python. If > this is the wrong list for such things, I appologize and please disregard the > rest. No, this is totally the right place. > My application needs to allow users to create scripts which will be

Re: Chunking sequential values in a list

2006-07-13 Thread Paul Rubin
David Hirschfield <[EMAIL PROTECTED]> writes: > So sequentialChunks([1,2,3,5,6,8,12]) returns: > [[1,2,3],[5,6],[8],[12]] Ugly and not too efficient: find the break points and use them to make sub-lists. def sequentialChunks(l, stride=1): p = [0] + [i for i in xrange(1,len(l)) if l[i]-l[i-1]

Re: TFTP client in python

2006-07-13 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > Is there a TFTP client python module? I just need "get file" feature. > I came across two implementations on WEB, but they are kind of > unfinished (got the code from some mailing list!). Second hit in Google ("tftp python"): http://mail.python.org/pipermail/python-list

Re: Regular Expression problem

2006-07-13 Thread Ant
> So What should I do to get the exact value(here the value after > 'href=') in any case even if the > > tags are like these? >> > > > -OR- > > -OR- > The following should do it: expr = r'http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expression problem

2006-07-13 Thread Paul McGuire
Pyparsing is also good for recognizing basic HTML tags and their attributes, regardless of the order of the attributes. -- Paul testText = """sldkjflsa;faj here it would be 'mystylesheet.css'. I used the following regex to get this value(I dont know if it I thought I was doing fine until I go

Re: How properly manage memory of this PyObject* array?? (C extension)

2006-07-13 Thread [EMAIL PROTECTED]
> It's quite simple, really: You malloc it, you free it. John - I hope you don't mind that I really want to make sure I understand your good wisdom in this area by asking for clarification ASSUMPTIONS: 1. As long as we properly handle the reference counting of PyObjects then memory ma

Re: How to have application-wide global objects

2006-07-13 Thread Sanjay
Got crystal clear. Thanks a lot to all for the elaborated replies. Sanjay -- http://mail.python.org/mailman/listinfo/python-list

Re: How properly manage memory of this PyObject* array?? (C extension)

2006-07-13 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Now it would appear that if you **malloc an array of PyObjects** > (call it FOO[]) then you have an ambiguity > > The PyObject elements will be freed *for us* eventually by garbage > collector. > > Hence, we can't ever do 'free(FOO); ' because we don't know when >

<    1   2   3