Re: Splitting of string at an interval

2013-04-09 Thread Dave Angel
On 04/08/2013 10:38 PM, Steven D'Aprano wrote: On Mon, 08 Apr 2013 21:09:08 -0400, Roy Smith wrote: There's a whole competition about writing the smallest program which outputs the song 99 bottles of beer: http://codegolf.com/99-bottles-of-beer I see the top 10 entries are all written in

Re: Splitting of string at an interval

2013-04-08 Thread Roy Smith
In article mailman.263.1365390121.3114.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Mon, Apr 8, 2013 at 7:48 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Like every programming problem, the solution is to break it apart into small, simple steps that

Re: Splitting of string at an interval

2013-04-08 Thread Arnaud Delobelle
On 8 April 2013 14:21, Roy Smith r...@panix.com wrote: For a while, I was rabidly(*) into TDD (Test Driven Development). The cycle I was using was, Write a specification of a behavior, write a (failing) test for that behavior, then write the least possible amount of code to make the test

Re: Splitting of string at an interval

2013-04-08 Thread Roy Smith
On Apr 8, 2013, at 11:10 AM, Arnaud Delobelle wrote: On 8 April 2013 14:21, Roy Smith r...@panix.com wrote: For a while, I was rabidly(*) into TDD (Test Driven Development). The cycle I was using was, Write a specification of a behavior, write a (failing) test for that behavior, then

Re: Splitting of string at an interval

2013-04-08 Thread Chris Angelico
On Tue, Apr 9, 2013 at 1:37 AM, Roy Smith r...@panix.com wrote: I can't help point out, however, that if your initial implementation is to have your code return a constant, it's pretty likely to be an optimum solution in both time and space :-) Likely, but not certain. # 1 def

Re: Splitting of string at an interval

2013-04-08 Thread Arnaud Delobelle
On 8 April 2013 17:20, Chris Angelico ros...@gmail.com wrote: On Tue, Apr 9, 2013 at 1:37 AM, Roy Smith r...@panix.com wrote: I can't help point out, however, that if your initial implementation is to have your code return a constant, it's pretty likely to be an optimum solution in both time

Re: Splitting of string at an interval

2013-04-08 Thread Roy Smith
In article mailman.295.1365438635.3114.python-l...@python.org, Arnaud Delobelle arno...@gmail.com wrote: On 8 April 2013 17:20, Chris Angelico ros...@gmail.com wrote: On Tue, Apr 9, 2013 at 1:37 AM, Roy Smith r...@panix.com wrote: I can't help point out, however, that if your initial

Re: Splitting of string at an interval

2013-04-08 Thread Tim Chase
On 2013-04-08 21:09, Roy Smith wrote: http://codegolf.com/99-bottles-of-beer I see the top 10 entries are all written in Perl. I suppose this says something. About the capabilities of Perl for writing such code, or about the drinking habits of Perl programmers? :-)

Re: Splitting of string at an interval

2013-04-08 Thread Steven D'Aprano
On Mon, 08 Apr 2013 21:09:08 -0400, Roy Smith wrote: There's a whole competition about writing the smallest program which outputs the song 99 bottles of beer: http://codegolf.com/99-bottles-of-beer I see the top 10 entries are all written in Perl. I suppose this says something. When I

Re: Splitting of string at an interval

2013-04-08 Thread Andrew Berg
On 2013.04.08 21:38, Steven D'Aprano wrote: In fact, I may make it a bare . so that not only will it be the shortest program, but also the smallest program in terms of number of non-white pixels. Until someone implements it in Whitespace. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1

Re: Splitting of string at an interval

2013-04-08 Thread Chris Angelico
On Tue, Apr 9, 2013 at 12:38 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 08 Apr 2013 21:09:08 -0400, Roy Smith wrote: There's a whole competition about writing the smallest program which outputs the song 99 bottles of beer: http://codegolf.com/99-bottles-of-beer

Splitting of string at an interval

2013-04-07 Thread subhabangalore
Dear Group, I was looking to split a string in a particular interval, like, If I have a string, string=The Sun rises in the east of our earth I like to see it as, words=[The Sun,rises in,in the,east of,our earth] If any one of the learned members can kindly suggest. Regards, Subhabrata.

Re: Splitting of string at an interval

2013-04-07 Thread Dave Angel
On 04/07/2013 04:25 PM, subhabangal...@gmail.com wrote: Dear Group, I was looking to split a string in a particular interval, like, If I have a string, string=The Sun rises in the east of our earth Are you asserting that there is nothing but letters and whitespace in the string, and that

Re: Splitting of string at an interval

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 13:25:57 -0700, subhabangalore wrote: Dear Group, I was looking to split a string in a particular interval, like, If I have a string, string=The Sun rises in the east of our earth I like to see it as, words=[The Sun,rises in,in the,east of,our earth] If any one

Re: Splitting of string at an interval

2013-04-07 Thread Chris Angelico
On Mon, Apr 8, 2013 at 7:48 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Like every programming problem, the solution is to break it apart into small, simple steps that even a computer can follow. ... 5) Shortcut the whole thing, since the problem was underspecified, by