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

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: 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: 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: 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: 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

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: 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

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: 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 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: 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: 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: 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: 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: 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 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: 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: 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

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: 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

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: 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

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 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

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: 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

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: 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: 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 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: 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: 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: 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 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: 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: 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: 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: 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 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: 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

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

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('^'

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

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: 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, 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: 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: 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: 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

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: 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

Re: callable virtual method

2009-08-14 Thread Dave Angel
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's already too much

Re: Any way to adjust difflib algorithm?

2009-08-14 Thread Grant Edwards
On 2009-08-14, Grant Edwards wrote: > I'm trying to use difflib to compare two files, and it's not > producing very useful results. When comparing two lines where > only a few characters have changed, it usually seems to decide > that a line was deleted/inserted/replaced rather than changed. [.

Re: Any way to adjust difflib algorithm?

2009-08-14 Thread Chris Rebert
On Fri, Aug 14, 2009 at 2:38 PM, Grant Edwards wrote: > I'm trying to use difflib to compare two files, and it's not > producing very useful results.  When comparing two lines where > only a few characters have changed, it usually seems to decide > that a line was deleted/inserted/replaced rather t

Re: callable virtual method

2009-08-14 Thread Nigel Rantor
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's already too much

Re: implementing descriptors

2009-08-14 Thread Dave Angel
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 th

Any way to adjust difflib algorithm?

2009-08-14 Thread Grant Edwards
I'm trying to use difflib to compare two files, and it's not producing very useful results. When comparing two lines where only a few characters have changed, it usually seems to decide that a line was deleted/inserted/replaced rather than changed. Here's how I'm using it: #!/usr/bin/python

Re: callable virtual method

2009-08-14 Thread Jean-Michel Pichavant
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's already too much meaningful methods in my clas

Re: callable virtual method

2009-08-14 Thread Steven D'Aprano
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 not mean > it cannot d

Komodo(!)

2009-08-14 Thread David C Ullrich
Probably this isn't news to anyone but me, but just in case: Last I heard Komodo was a very highly regarded IDE that unfortunately cost money. Yesterday I discovered that they now have an editor available for free. Doesn't contain all the features of the IDE, but just having glanced at it it seem

Re: callable virtual method

2009-08-14 Thread Nigel Rantor
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's already too much meaningful methods in my class for me to add artif

Re: trouble with reload

2009-08-14 Thread Steven D'Aprano
On Fri, 14 Aug 2009 13:14:16 -0400, Colin J. Williams wrote: > Steven D'Aprano wrote: >> On Fri, 14 Aug 2009 09:23:17 -0400, Colin J. Williams wrote: >> >>> It's typically a user module that needs to be reloaded. >> >> What's a user module? > A module written by a user, as distinguished from a l

Re: retrieve item from nested list given index tuple

2009-08-14 Thread Alan G Isaac
On 8/14/2009 1:09 PM Steven D'Aprano apparently wrote: > Try this instead: > from operator import getitem reduce(getitem, (2, 1, 0), lst) > 'aaa' reduce(getitem, (2, 1, 0, 0), lst) > 'a' > > operator.getitem is less ugly too. Yes, that's better. Thanks, Alan -- http://mail.pytho

Re: retrieve item from nested list given index tuple

2009-08-14 Thread Colin J. Williams
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 helper function, then us

Re: Unrecognized escape sequences in string literals

2009-08-14 Thread Steven D'Aprano
I think I've spent enough time on this discussion, so I won't be directly responding to any of your recent points -- it's clear that I'm not persuading you that there's any justification for any behaviour for escape sequences other than the way C++ deals with them. That's your prerogative, of c

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

2009-08-14 Thread Jean-Michel Pichavant
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 express some frustration with whitespace-mode. You took my question out of context and ans

Re: callable virtual method

2009-08-14 Thread Jean-Michel Pichavant
Diez B. Roggisch wrote: Jean-Michel Pichavant schrieb: MRAB wrote: Jean-Michel Pichavant wrote: Hi fellows, Does anyone know a way to write virtual methods (in one virtual class) that will raise an exception only if called without being overridden ? Currently in the virtual method I'm check

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

2009-08-14 Thread vippstar
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 express some frustration with whitespace-mode. You took my question out of context and answered it. I read the article, it's

Re: httplib incredibly slow :-(

2009-08-14 Thread Chris Withers
Aahz wrote: Sorry, I mostly have been working on our Mac port, so I'm not sure what's needed to make this work on Windows. Did you try downloading the PyCurl binary? Maybe it statically links libcurl on Windows. Shame it's not available as a bdist_egg, that's what I'm really after... What d

Re: trouble with reload

2009-08-14 Thread Colin J. Williams
Steven D'Aprano wrote: On Fri, 14 Aug 2009 09:23:17 -0400, Colin J. Williams wrote: It's typically a user module that needs to be reloaded. What's a user module? A module written by a user, as distinguished from a libary It seems that del sys.modules['moduleName'] has no effect. sys.m

Re: csv.DictWriter.write_header()

2009-08-14 Thread Chris Withers
Alan G Isaac wrote: On 8/13/2009 7:58 AM John Machin apparently wrote: Duck typing: ask a silly question, get a silly answer. Maybe if you learned to be a more generous reader, fewer questions would look "silly" to you. If you take a look at the crap that John very patiently wades through on

Re: retrieve item from nested list given index tuple

2009-08-14 Thread Steven D'Aprano
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 helper function, then use it: # Untested def

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

2009-08-14 Thread vippstar
On Aug 14, 4:36 am, Xah Lee wrote: > • A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode >  http://xahlee.org/UnixResource_dir/writ/emacs_whitespace-mode_problem... Instead of writing a completely useless article you could had asked for help in an emacs newsgroup, or wait until som

Re: [Python-Dev] expy: an expressway to extend Python

2009-08-14 Thread Yingjie Lan
--- On Sat, 8/8/09, Stefan Behnel wrote: > From: Stefan Behnel > Subject: Re: [Python-Dev] expy: an expressway to extend Python > To: python-...@python.org > Date: Saturday, August 8, 2009, 4:55 PM > > More details at http://expy.sourceforge.net/ > > I'm clearly biased, but my main concern here

Re: callable virtual method

2009-08-14 Thread Diez B. Roggisch
Jean-Michel Pichavant schrieb: MRAB wrote: Jean-Michel Pichavant wrote: Hi fellows, Does anyone know a way to write virtual methods (in one virtual class) that will raise an exception only if called without being overridden ? Currently in the virtual method I'm checking that the class of the

Re: Python Permutations Problem

2009-08-14 Thread MRAB
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: Group #1: c,r,b Group #2: a,z,k G

Re: callable virtual method

2009-08-14 Thread Jean-Michel Pichavant
MRAB wrote: Jean-Michel Pichavant wrote: Hi fellows, Does anyone know a way to write virtual methods (in one virtual class) that will raise an exception only if called without being overridden ? Currently in the virtual method I'm checking that the class of the instance calling the method ha

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

2009-08-14 Thread Douglas Alan
On Aug 14, 12:17 pm, Grant Edwards wrote: > On 2009-08-14, Steven D'Aprano wrote: > > On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: > >> "I saw `cout' being shifted "Hello world" times to the left and stopped > >> right there."  --Steve Gonedes > > > Assuming that's something real, and not i

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

2009-08-14 Thread MRAB
Grant Edwards wrote: On 2009-08-14, Steven D'Aprano wrote: On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: "I saw `cout' being shifted "Hello world" times to the left and stopped right there." --Steve Gonedes Assuming that's something real, and not invented for humour, I presume that's desc

Re: Why does my ftp script quit after couple of hours?

2009-08-14 Thread Diez B. Roggisch
kk schrieb: Hi Diez Thanks for your insight. The reason I chose the awkward method to parse the ip digits is that I was not familiar with the regex module and the Dyndns Ip page is pretty simple page. I guess it is time to learn more about the Re module. As far as robustness, I agree with your

Natural Language Processing in Python

2009-08-14 Thread Prateek
Hi, Can somebody please provide me link to a good online resource or e- book for doing natural language processing programming in Python. Thanks, Prateek -- http://mail.python.org/mailman/listinfo/python-list

Python Permutations Problem

2009-08-14 Thread Asanka Wasala
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: Group #1: c,r,b Group #2: a,z,k Group #3: h,t . . Lette

Re: Why does my ftp script quit after couple of hours?

2009-08-14 Thread Francesco Bochicchio
On 14 Ago, 18:03, kk wrote: > Hi > This way the first time I did something with ftp stuff. I think that > generally it works but it stops working(quits or disappears) after > couple of hours of running. > > This was a personal test-trial script for my own needs which was to > get my dynamic ip and

Re: Why does my ftp script quit after couple of hours?

2009-08-14 Thread kk
Hi Diez Thanks for your insight. The reason I chose the awkward method to parse the ip digits is that I was not familiar with the regex module and the Dyndns Ip page is pretty simple page. I guess it is time to learn more about the Re module. As far as robustness, I agree with your assestment. I

Re: Why does my ftp script quit after couple of hours?

2009-08-14 Thread Diez B. Roggisch
kk schrieb: Hi This way the first time I did something with ftp stuff. I think that generally it works but it stops working(quits or disappears) after couple of hours of running. This was a personal test-trial script for my own needs which was to get my dynamic ip and broadcast to a client(I hav

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

2009-08-14 Thread Grant Edwards
On 2009-08-14, Steven D'Aprano wrote: > On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: > >> "I saw `cout' being shifted "Hello world" times to the left and stopped >> right there." --Steve Gonedes > > Assuming that's something real, and not invented for humour, I presume > that's describing som

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

2009-08-14 Thread Steven D'Aprano
On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: > "I saw `cout' being shifted "Hello world" times to the left and stopped > right there." --Steve Gonedes Assuming that's something real, and not invented for humour, I presume that's describing something possible in C++. Am I correct? What the he

Why does my ftp script quit after couple of hours?

2009-08-14 Thread kk
Hi This way the first time I did something with ftp stuff. I think that generally it works but it stops working(quits or disappears) after couple of hours of running. This was a personal test-trial script for my own needs which was to get my dynamic ip and broadcast to a client(I have a client scr

  1   2   >