Re: Komodo(!)

2009-08-14 Thread Kee Nethery
From the web site it looks like the free version does not include the debugging stuff. I've been using the paid version with the debugger functionality and I find it easy to use and incredibly nice for trying to understand what the code is doing. The built-in debugger has saved me tons of t

Something like wibiya?

2009-08-14 Thread kennyken747
Would Python be an efficient language to go about coding something like the toolbar from http://www.wibiya.com/index.php ? And then, how would I implement it? -Kenny Ledet Owner of Hotontheblock.com, Urban News Blog -- http://mail.python.org/mailman/listinfo/python-list

Re: retrieve item from nested list given index tuple

2009-08-14 Thread Dave Angel
Colin J. Williams wrote: Steven D'Aprano wrote: On Fri, 14 Aug 2009 15:54:54 +, Alan G Isaac wrote: `lst` is a nested list `tpl` is the indexes for an item in the list What is the nice way to retrieve the item? (Speedy access is nice.) Assuming you want to do this frequently, write a

Re: retrieve item from nested list given index tuple

2009-08-14 Thread Colin J. Williams
Dave Angel wrote: Colin J. Williams wrote: Steven D'Aprano wrote: On Fri, 14 Aug 2009 15:54:54 +, Alan G Isaac wrote: `lst` is a nested list `tpl` is the indexes for an item in the list What is the nice way to retrieve the item? (Speedy access is nice.) Assuming you want to do thi

Re: Python Permutations Problem

2009-08-14 Thread Mensanator
On Aug 14, 11:28 am, Asanka Wasala wrote: > Hi > I am developing a spell checker for my language, and I came across > solving an interesing problem. It would be great if you can suggest > me  an optimized solution for the problem described below: > > I have certain group of letters like these: > >

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-14 Thread Erik Max Francis
Grant Edwards wrote: On 2009-08-14, Steven D'Aprano wrote: What the hell would it actually do??? IIRC in C++, cout << "Hello world"; is equivalent to this in C: printf("Hellow world"); or this in Python: print "hellow world" Well, plus or minus newlines. -- Erik Max Francis

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-14 Thread Grant Edwards
On 2009-08-14, Erik Max Francis wrote: > Grant Edwards wrote: >> On 2009-08-14, Steven D'Aprano wrote: >>> What the hell >>> would it actually do??? >> >> IIRC in C++, >> >>cout << "Hello world"; >> >> is equivalent to this in C: >> >>printf("Hellow world"); >> >> or this in Python:

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-14 Thread Erik Max Francis
Grant Edwards wrote: On 2009-08-14, Erik Max Francis wrote: Grant Edwards wrote: On 2009-08-14, Steven D'Aprano wrote: What the hell would it actually do??? IIRC in C++, cout << "Hello world"; is equivalent to this in C: printf("Hellow world"); or this in Python: print "hello

Re: callable virtual method

2009-08-14 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Fri, 14 Aug 2009 18:49:26 +0200, Jean-Michel Pichavant wrote: Sorry guys (means guys *and* gals :op ), I realized I've not been able to describe precisely what I want to do. I'd like the base class to be virtual (aka abstract). However it may be abstract but it does

Splitting on '^' ?

2009-08-14 Thread kj
Sometimes I want to split a string into lines, preserving the end-of-line markers. In Perl this is really easy to do, by splitting on the beginning-of-line anchor: @lines = split /^/, $string; But I can't figure out how to do the same thing with Python. E.g.: >>> import re >>> re.split('^'

py-rrdTool - install fails

2009-08-14 Thread guthrie
I want to do some rrd in a python cgi script, but am having trouble getting an easy install module. py-rrdTool looks good, but is distributed in c source, and is missing a header file in the distribution. Thus the install fails when it tries to reference rrd.h which is not there. Are there better

Re: Splitting on '^' ?

2009-08-14 Thread Gary Herron
kj wrote: Sometimes I want to split a string into lines, preserving the end-of-line markers. In Perl this is really easy to do, by splitting on the beginning-of-line anchor: @lines = split /^/, $string; But I can't figure out how to do the same thing with Python. E.g.: import re re.spl

Re: Splitting on '^' ?

2009-08-14 Thread Tycho Andersen
On Fri, Aug 14, 2009 at 3:23 PM, kj wrote: > [snip] import re re.split('^', 'spam\nham\neggs\n') > ['spam\nham\neggs\n'] re.split('(?m)^', 'spam\nham\neggs\n') > ['spam\nham\neggs\n'] bol_re = re.compile('^', re.M) bol_re.split('spam\nham\neggs\n') > ['spam\nham\neggs\n'] >

Re: py-rrdTool - install fails

2009-08-14 Thread Christian Heimes
guthrie schrieb: I want to do some rrd in a python cgi script, but am having trouble getting an easy install module. py-rrdTool looks good, but is distributed in c source, and is missing a header file in the distribution. Thus the install fails when it tries to reference rrd.h which is not there

Re: Splitting on '^' ?

2009-08-14 Thread Gabriel
On Fri, Aug 14, 2009 at 5:23 PM, kj wrote: > import re re.split('^', 'spam\nham\neggs\n') > ['spam\nham\neggs\n'] re.split('(?m)^', 'spam\nham\neggs\n') > ['spam\nham\neggs\n'] bol_re = re.compile('^', re.M) bol_re.split('spam\nham\neggs\n') > ['spam\nham\neggs\n'] > > Am I

Re: Splitting on '^' ?

2009-08-14 Thread Brian
On Fri, Aug 14, 2009 at 2:23 PM, kj wrote: > > > Sometimes I want to split a string into lines, preserving the > end-of-line markers. In Perl this is really easy to do, by splitting > on the beginning-of-line anchor: > > @lines = split /^/, $string; > > But I can't figure out how to do the same

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-14 Thread Benjamin Kaplan
On Fri, Aug 14, 2009 at 12:42 PM, Douglas Alan wrote: > > P.S. Overloading "left shift" to mean "output" does indeed seem a bit > sketchy, but in 15 years of C++ programming, I've never seen it cause > any confusion or bugs. The only reason it hasn't is because people use it in "Hello World". I

Re: callable virtual method

2009-08-14 Thread Jean-Michel Pichavant
Dave Angel wrote: Jean-Michel Pichavant wrote: Nigel Rantor wrote: Jean-Michel Pichavant wrote: Your solution will work, for sure. The problem is that it will dumb down the Base class interface, multiplying the number of methods by 2. This would not be an issue in many cases, in mine there'

Re: Komodo(!)

2009-08-14 Thread John Wells
On Fri, Aug 14, 2009 at 3:28 PM, Kee Nethery wrote: > From the web site it looks like the free version does not include the > debugging stuff. > > I've been using the paid version with the debugger functionality and I find > it easy to use and incredibly nice for trying to understand what the code

Re: Komodo(!)

2009-08-14 Thread William
Personally, I rather like Wing From: Kee Nethery To: python-list@python.org Sent: Friday, August 14, 2009 3:28:54 PM Subject: Re: Komodo(!) >From the web site it looks like the free version does not include the >debugging stuff. I've been using the paid versi

Re: Splitting on '^' ?

2009-08-14 Thread MRAB
Gary Herron wrote: kj wrote: Sometimes I want to split a string into lines, preserving the end-of-line markers. In Perl this is really easy to do, by splitting on the beginning-of-line anchor: @lines = split /^/, $string; But I can't figure out how to do the same thing with Python. E.g.:

Re: something like perl's Mail::GPG ?

2009-08-14 Thread Piet van Oostrum
> akonsu (a) wrote: >a> hello, >a> i am looking for a module with functionality similar to that of the >a> Perl's Mail::GPG package. I need to verify multipart emails that are >a> PGP-signed. I don't know Perl's GPG package, but to verify PGP-signed stuff you can use gnupg. It doesn't have s

Re: Splitting on '^' ?

2009-08-14 Thread Ethan Furman
kj wrote: Sometimes I want to split a string into lines, preserving the end-of-line markers. In Perl this is really easy to do, by splitting on the beginning-of-line anchor: @lines = split /^/, $string; But I can't figure out how to do the same thing with Python. E.g.: import re re.spli

Re: Natural Language Processing in Python

2009-08-14 Thread Jeroen Ruigrok van der Werven
-On [20090814 18:39], Prateek (prateekkakir...@gmail.com) wrote: >Can somebody please provide me link to a good online resource or e- >book for doing natural language processing programming in Python. http://www.nltk.org/ comes to mind. -- Jeroen Ruigrok van der Werven / asmodai イェルーン

Re: Splitting on '^' ?

2009-08-14 Thread Piet van Oostrum
> kj (k) wrote: >k> Sometimes I want to split a string into lines, preserving the >k> end-of-line markers. In Perl this is really easy to do, by splitting >k> on the beginning-of-line anchor: >k> @lines = split /^/, $string; >k> But I can't figure out how to do the same thing with Python

Re: Splitting on '^' ?

2009-08-14 Thread rurpy
On Aug 14, 2:23 pm, kj wrote: > Sometimes I want to split a string into lines, preserving the > end-of-line markers.  In Perl this is really easy to do, by splitting > on the beginning-of-line anchor: > >   @lines = split /^/, $string; > > But I can't figure out how to do the same thing with Pytho

Calling parent constructor with different argument list

2009-08-14 Thread pinkisntwell
class Vertex(tuple): pass class Positioned_Vertex(Vertex): def __init__(self, a, b): Vertex.__init__(a) a=Positioned_Vertex((0,0,0), 1) This gives: TypeError: tuple() takes at most 1 argument (2 given) It looks like the explicit call to Vertex.__init__ is never made and Vertex

Re: callable virtual method

2009-08-14 Thread Christian Heimes
Jean-Michel Pichavant wrote: talking about approaches: 1/ class Interface: def foo(self): if self.__class__.foo == Interface.foo: raise NotImplementedError 2/ class Interface: def foo(self): self._foo() def _foo(sef): raise NotImplementedError Pleas

Re: How to launch a function at regular time intervals ?

2009-08-14 Thread David
With your help, Franck, I think I finally got it to work. This is how I did it: # In the main program, launch the 2 threads CStoreData and CTransferData, which will run indefinitely until they are stopped (if the threads were launched inside the while loop, there would be an infinitely growing num

Re: How to launch a function at regular time intervals ?

2009-08-14 Thread David
With your help, Franck, I think I finally got it to work. This is how I did it: # In the main program, launch the 2 threads CStoreData and CTransferData, which will run indefinitely until they are stopped (if the threads were launched inside the while loop, there would be an infinitely growing num

Re: How to launch a function at regular time intervals ?

2009-08-14 Thread David
With your help, Franck, I think I finally got it to work. This is how I did it: # In the main program, launch the 2 threads CStoreData and CTransferData, which will run indefinitely until they are stopped (if the threads were launched inside the while loop, there would be an infinitely growing num

Re: Splitting on '^' ?

2009-08-14 Thread MRAB
Ethan Furman wrote: kj wrote: Sometimes I want to split a string into lines, preserving the end-of-line markers. In Perl this is really easy to do, by splitting on the beginning-of-line anchor: @lines = split /^/, $string; But I can't figure out how to do the same thing with Python. E.g.:

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-14 Thread magicus
On Fri, 14 Aug 2009 19:57:17 +0200, Jean-Michel Pichavant wrote: > vippstar wrote: >> On Aug 14, 8:25 pm, fortunatus wrote: >> >>> On Aug 14, 1:01 pm, vippstar wrote: >>> >>> Why would you fill your website with junk? >>> The OP made it clear: >>> >>> Just wanted to exp

Re: How to launch a function at regular time intervals ?

2009-08-14 Thread MRAB
David wrote: With your help, Franck, I think I finally got it to work. This is how I did it: # In the main program, launch the 2 threads CStoreData and CTransferData, which will run indefinitely until they are stopped (if the threads were launched inside the while loop, there would be an infinit

Re: coding for multiple versions of python

2009-08-14 Thread Martin v. Löwis
>> Specifically, put the source code into /net/source/python/foo/*.py. >> Then, on each system, put symlinks to all .py files into >> lib/site-packages/foo. Then Python will place the .pyc files next >> to the symlinks, not next to the actual .py files. > > Why would he need two sets of .py files?

Re: coding for multiple versions of python

2009-08-14 Thread Martin v. Löwis
> He's assuming: >1) an OS that supports symlinks >2) two versions of Python on same system >3) one set of pure-python sources that want to stay in synch for both > versions. Actually, the OP said he has HP(-UX, I assume), and Linux, so it would be two versions of Python on different

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-14 Thread Brian
On Fri, Aug 14, 2009 at 4:46 PM, magicus wrote: > On Fri, 14 Aug 2009 19:57:17 +0200, Jean-Michel Pichavant > wrote: > > > vippstar wrote: > >> On Aug 14, 8:25 pm, fortunatus wrote: > >> > >>> On Aug 14, 1:01 pm, vippstar wrote: > >>> > >>> > Why would you fill your website with junk? > >>

Re: Splitting on '^' ?

2009-08-14 Thread Ethan Furman
MRAB wrote: Ethan Furman wrote: kj wrote: Sometimes I want to split a string into lines, preserving the end-of-line markers. In Perl this is really easy to do, by splitting on the beginning-of-line anchor: @lines = split /^/, $string; But I can't figure out how to do the same thing with

Re: Calling parent constructor with different argument list

2009-08-14 Thread Mark Lawrence
pinkisntwell wrote: class Vertex(tuple): pass class Positioned_Vertex(Vertex): def __init__(self, a, b): def __init__(self, a): # just take out b Vertex.__init__(a) a=Positioned_Vertex((0,0,0), 1) a=Positioned_Vertex( ( (0,0,0), 1) ) # and add a pair of brackets print a Th

Re: fileinput

2009-08-14 Thread naaman
On Aug 13, 11:41 pm, naaman wrote: > On Aug 13, 7:50 am, Dave Angel wrote: > > > > > naaman wrote: > > > On Aug 12, 1:35 pm, Dave Angel wrote: > > > >> naaman wrote: > > > >>> I'm writing my first Python script and > > >>> I want to use fileinput to open a file in r+ mode. > > >>> Tried fileinpu

Re: Calling parent constructor with different argument list

2009-08-14 Thread Gabriel Genellina
En Fri, 14 Aug 2009 19:24:26 -0300, pinkisntwell escribió: class Vertex(tuple): pass class Positioned_Vertex(Vertex): def __init__(self, a, b): Vertex.__init__(a) a=Positioned_Vertex((0,0,0), 1) This gives: TypeError: tuple() takes at most 1 argument (2 given) It looks l

Splitting a string into substrings of equal size

2009-08-14 Thread candide
Suppose you need to split a string into substrings of a given size (except possibly the last substring). I make the hypothesis the first slice is at the end of the string. A typical example is provided by formatting a decimal string with thousands separator. What is the pythonic way to do this ?

Re: Splitting a string into substrings of equal size

2009-08-14 Thread Gabriel Genellina
En Fri, 14 Aug 2009 21:22:57 -0300, candide escribió: Suppose you need to split a string into substrings of a given size (except possibly the last substring). I make the hypothesis the first slice is at the end of the string. A typical example is provided by formatting a decimal string wi

Python 'for' loop is memory inefficient

2009-08-14 Thread Dr. Phillip M. Feldman
I wrote the following correct but inefficient test of primality for purposes of demonstrating that the simplest algorithm is often not the most efficient. But, when I try to run the following code with a value of n that is large enough to produce a significant amount of running time, I get an out

Re: implementing descriptors

2009-08-14 Thread Ethan Furman
dippim wrote: On Aug 14, 10:48 am, Dave Angel wrote: dippim wrote: On Aug 14, 2:34 am, Raymond Hettinger wrote: [David] I am new to Python and I have a question about descriptors. If I have a class as written below, is there a way to use descriptors to be certain that the datetime in

Re: Python 'for' loop is memory inefficient

2009-08-14 Thread Stephen Hansen
> > It seems as though Python is actually expanding range(2,n) into a list of > numbers, even though this is incredibly wasteful of memory. There should be > a looping mechanism that generates the index variable values incrementally > as they are needed. This has nothing to do with Python's for l

Re: Python 'for' loop is memory inefficient

2009-08-14 Thread Mark Lawrence
Dr. Phillip M. Feldman wrote: I wrote the following correct but inefficient test of primality for purposes of demonstrating that the simplest algorithm is often not the most efficient. But, when I try to run the following code with a value of n that is large enough to produce a significant amoun

Re: Programming by Contract

2009-08-14 Thread Ethan Furman
Charles Yeomans wrote: On Aug 14, 2009, at 12:09 AM, Scott David Daniels wrote: Charles Yeomans wrote: On Aug 11, 2009, at 3:30 PM, Ethan Furman wrote: Ethan Furman wrote: Greetings! I have seen posts about the assert statement and PbC (or maybe it was DbC), and I just took a very b

Re: Python 'for' loop is memory inefficient

2009-08-14 Thread Ethan Furman
Dr. Phillip M. Feldman wrote: I wrote the following correct but inefficient test of primality for purposes of demonstrating that the simplest algorithm is often not the most efficient. But, when I try to run the following code with a value of n that is large enough to produce a significant amoun

Re: implementing descriptors

2009-08-14 Thread Terry Reedy
dippim wrote: will say that as this particular requirement is imposed on this class by the writer, shouldn't it be the writer's responsibility to enforce it, especially, when the cost of enforcement is so low? I would say that it is the writer's responsibility to set the requirement and be cl

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-14 Thread Terry Reedy
greg wrote: You can't read and write with the same stdio file object at the same time. Odd things tend to happen if you try. I believe the C standard specifies that the behavior of mixed reads and writes is undefined without intervening seek and/or flush, even if the seek is ignored (as it i

Re: Python 'for' loop is memory inefficient

2009-08-14 Thread r
On Aug 14, 8:25 pm, "Dr. Phillip M. Feldman" wrote: > I wrote the following correct but inefficient test of primality for purposes > of demonstrating that the simplest algorithm is often not the most > efficient.  But, when I try to run the following code with a value of n that > is large enough t

Re: Splitting a string into substrings of equal size

2009-08-14 Thread Jan Kaliszewski
15-08-2009 candide wrote: Suppose you need to split a string into substrings of a given size (except possibly the last substring). I make the hypothesis the first slice is at the end of the string. A typical example is provided by formatting a decimal string with thousands separator. I'd

Re: Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-14 Thread Dave Angel
Benjamin Kaplan wrote: On Fri, Aug 14, 2009 at 12:42 PM, Douglas Alan wrote: P.S. Overloading "left shift" to mean "output" does indeed seem a bit sketchy, but in 15 years of C++ programming, I've never seen it cause any confusion or bugs. The only reason it hasn't is because people

Re: Splitting a string into substrings of equal size

2009-08-14 Thread Jan Kaliszewski
15-08-2009 Jan Kaliszewski wrote: 15-08-2009 candide wrote: Suppose you need to split a string into substrings of a given size (except possibly the last substring). I make the hypothesis the first slice is at the end of the string. A typical example is provided by formatting a decimal str

Re: py-rrdTool - install fails

2009-08-14 Thread guthrie
On Aug 14, 3:39 pm, Christian Heimes wrote: > guthrie schrieb: > > > > > I want to do some rrd in a python cgi script, but am having trouble > > getting an easy install module. > > > py-rrdTool looks good, but is distributed in c source, and is missing > > a header file in the distribution. Thus t

unittest

2009-08-14 Thread Mag Gam
I am writing an application which has many command line arguments. For example: foo.py -args "bar bee" I would like to create a test suit using unittest so when I add features to "foo.py" I don't want to break other things. I just heard about unittest and would love to use it for this type of thin

Re: coding for multiple versions of python

2009-08-14 Thread Tim Arnold
"Tim Arnold" wrote in message news:h61gld$it...@foggy.unx.sas.com... > Hi, > I've got a python based system that has to run on hp unix and red hat > linux. The Python version on the HP is 2.4 and the version on the Linux > box is 2.6. There's nothing I can do about that. > > I think that means

Re: httplib incredibly slow :-(

2009-08-14 Thread Dieter Maurer
Chris Withers writes on Thu, 13 Aug 2009 08:20:37 +0100: > ... > I've already established that the file downloads in seconds with > [something else], so I'd like to understand why python isn't doing the > same and fix the problem... A profile might help to understand what the time is used for.

Re: getting a "simple" program to work

2009-08-14 Thread John Haggerty
I'm checking back with some new info. Apparently the maintainer of the ogss package indicated that this is definately an issue with the libgmail package. Now I have already submtted help to the maintainer of libgmail to get some help it making his project work again. I am also interesetd in how

Re: Python docs disappointing - group effort to hire writers?

2009-08-14 Thread Bill Jones
On Aug 8, 3:27 pm, Mark Lawrence wrote: > Kee Nethery wrote: > > As someone trying to learn the language I want to say that the tone on > > this list towards people who are trying to learn Python  feels like it > > has become anti-newbies. > > [snip] > > > Kee Nethery > > My gut feeling (which cou

Re: Splitting a string into substrings of equal size

2009-08-14 Thread Rascal
I'm bored for posting this, but here it is: def add_commas(str): str_list = list(str) str_len = len(str) for i in range(3, str_len, 3): str_list.insert(str_len - i, ',') return ''.join(str_list) -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest

2009-08-14 Thread Richard Thomas
On Aug 15, 4:28 am, Mag Gam wrote: > I am writing an application which has many command line arguments. > For example: foo.py -args "bar bee" > > I would like to create a test suit using unittest so when I add > features to "foo.py" I don't want to break other things. I just heard > about unittest

<    1   2