In article <4c70344a$0$1659$742ec...@news.sonic.net>,
John Nagle wrote:
>
>Realistically, recursion isn't that important in Python. It's
>there if you need it, and sometimes useful, but generally not used
>much without good reason. In some functional languages, recursion
>is routinely used
In article <4c6e9de9$0$23142$426a7...@news.free.fr>,
Bruno Desthuilliers wrote:
>Steven D'Aprano a écrit :
>> On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
>>>
>>> Recursion can be quite a trick to get your mind round at first
>>
>> Really? Do people actually find the *concept* of
Bruno Desthuilliers writes:
> BartC a écrit :
>> "Steven D'Aprano" wrote in
>> message news:4c6f8edd$0$28653$c3e8...@news.astraweb.com...
>>> On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote:
>>
I onced worked in a shop (Win32 desktop / accouting applications mainly)
where
BartC a écrit :
"Steven D'Aprano" wrote in
message news:4c6f8edd$0$28653$c3e8...@news.astraweb.com...
On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote:
I onced worked in a shop (Win32 desktop / accouting applications mainly)
where I was the only guy that could actually understan
"Steven D'Aprano" wrote in message
news:4c6f8edd$0$28653$c3e8...@news.astraweb.com...
On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote:
I onced worked in a shop (Win32 desktop / accouting applications mainly)
where I was the only guy that could actually understand recursion. FWIW
Steven D'Aprano a écrit :
On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote:
Steven D'Aprano a écrit :
On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
Recursion can be quite a trick to get your mind round at first
Really? Do people actually find the *concept* of recur
On 8/21/2010 8:32 PM, Steven D'Aprano wrote:
On Sat, 21 Aug 2010 19:09:52 -0500, John Bokma wrote:
this means that Python should eliminate / optimize tail
recursion.
There have been various suggestions to add tail recursion optimization to
the language. Two problems:
* It throws away inform
Steven D'Aprano writes:
> On Sat, 21 Aug 2010 19:09:52 -0500, John Bokma wrote:
>
>> this means that Python should eliminate / optimize tail
>> recursion.
>
> There have been various suggestions to add tail recursion optimization to
> the language. Two problems:
[snip]
> But this is not the on
Steven D'Aprano writes:
> * It throws away information from tracebacks if the recursive function
> fails; and
[...]
> If you're like me, you're probably thinking that the traceback from an
> exception in a recursive function isn't terribly useful.
Agreed. On the other hand, a full-fledged tai
On Sat, 21 Aug 2010 19:09:52 -0500, John Bokma wrote:
> this means that Python should eliminate / optimize tail
> recursion.
There have been various suggestions to add tail recursion optimization to
the language. Two problems:
* It throws away information from tracebacks if the recursive funct
John Nagle writes:
> On 8/20/2010 1:17 PM, John Bokma wrote:
>> John Nagle writes:
>>
>>> Python does not do tail recursion, so using recursion
>>> where iteration could do the job is generally a bad idea. Scheme, on
>>> the other hand, always does tail recursion where possible.
>>
>> I th
On 8/21/2010 10:08 AM, Michael Torrie wrote:
On 08/21/2010 03:03 AM, Steven D'Aprano wrote:
- there must be a condition where the recursion has to stop otherwise
the routine will continue to call itself infinitely.
This is called the Base Case
I agree with this, although I've never heard th
On 08/21/2010 03:03 AM, Steven D'Aprano wrote:
>> - there must be a condition where the recursion has to stop otherwise
>> the routine will continue to call itself infinitely.
>> This is called the Base Case
>
> I agree with this, although I've never heard the name "Base Case" before.
"Base Cas
On 21/08/2010 01:24, Martin Gregorie wrote:
On Fri, 20 Aug 2010 16:22:44 -0700, Baba wrote:
> For the purposes of learning programming i think it's a must to
> understand Recursion so thanks all for your help!
>
That depends on the language and/or hardware. COBOL wouldn't understand
recursi
On 21/08/2010 00:17, Ben Finney wrote:
Steven D'Aprano writes:
On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
Recursion can be quite a trick to get your mind round at first
Really? Do people actually find the *concept* of recursion to be
tricky?
Evidently so. It's folk wisdom
Baba wrote:
On Aug 21, 7:37 am, John Nagle wrote:
On 8/20/2010 1:17 PM, John Bokma wrote:
I think you mean tail recursion optimization / elimination.
Python does tail recursion:
Not very well.
def cnt(n) :
if n > 0 :
cnt(n-1)
Hi John
I'm
On 08/21/10 03:31, Steven D'Aprano wrote:
On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote:
I also was the only guy around that understood "hairy" (lol) concepts
like callback functions, FSM,
FSM? Flying Spaghetti Monster?
I'm guessing "Finite State Machines". But in a way, "Fl
On 08/21/10 04:35, Baba wrote:
On Aug 21, 7:37 am, John Nagle wrote:
On 8/20/2010 1:17 PM, John Bokma wrote:
I think you mean tail recursion optimization / elimination.
Python does tail recursion:
Not very well.
def cnt(n) :
if n> 0 :
cnt(n-1)
I'm intri
On Aug 21, 7:37 am, John Nagle wrote:
> On 8/20/2010 1:17 PM, John Bokma wrote:
>
> > I think you mean tail recursion optimization / elimination.
> > Python does tail recursion:
>
> Not very well.
>
> def cnt(n) :
> if n > 0 :
> cnt(n-1)
>
Hi John
I'm intrigued by
On Fri, 20 Aug 2010 16:42:26 -0700, Baba wrote:
> For future readers of this post who want to learn to programm (just like
> myself) let me re-state the basics i have learned now:
I would disagree in part with nearly all of these.
> - a procedure is said to be recursive when it contains a statem
On Fri, 20 Aug 2010 17:23:23 +0200, Bruno Desthuilliers wrote:
> Steven D'Aprano a écrit :
>> On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
>>
>>> Recursion can be quite a trick to get your mind round at first
>>
>> Really? Do people actually find the *concept* of recursion to be
>>
On Fri, 20 Aug 2010 09:47:30 +0200, News123 wrote:
> On 08/20/2010 02:26 AM, Steven D'Aprano wrote:
>> On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
>>
>>> Recursion can be quite a trick to get your mind round at first
>>
>> Really? Do people actually find the *concept* of recursion
On 8/20/2010 1:17 PM, John Bokma wrote:
John Nagle writes:
Python does not do tail recursion, so using recursion
where iteration could do the job is generally a bad idea. Scheme, on
the other hand, always does tail recursion where possible.
I think you mean tail recursion optimization
On Fri, 20 Aug 2010 16:22:44 -0700, Baba wrote:
> For the purposes of learning programming i think it's a must to
> understand Recursion so thanks all for your help!
>
That depends on the language and/or hardware. COBOL wouldn't understand
recursion if hit on the head with a recursion brick and e
On Saturday 21 August 2010, it occurred to Baba to exclaim:
> - every time the procedure calls itself the memory gradually fills up
> with the copies until the whole thing winds down again
> as the "return" statements start being executed.
> - the above point means that a recursive approach is ex
On Aug 19, 11:00 pm, Martin Gregorie
wrote:
> By way of a hint, here are two versions of the classic example of
> recursion: calculating factorials. Recursion can be quite a trick to get
> your mind round at first, so compare the two and follow through their
> operation step by step...
Hi Martin
Hi Martin
Thanks for your post. This basic but fundamental computation is a
great example when trying to understand the concept of recursion for
the first time.
Also thanks to John for the stackoverflow link where i found a very
good summarised definition completing some of the posts left here.
Steven D'Aprano writes:
> On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
>
> > Recursion can be quite a trick to get your mind round at first
>
> Really? Do people actually find the *concept* of recursion to be
> tricky?
Evidently so. It's folk wisdom that some adults find recursion
John Nagle writes:
> Python does not do tail recursion, so using recursion
> where iteration could do the job is generally a bad idea. Scheme, on
> the other hand, always does tail recursion where possible.
I think you mean tail recursion optimization / elimination.
Python does tail recursi
On 2010-08-20, John Nagle wrote:
> Python does not do tail recursion, so using recursion where
> iteration could do the job is generally a bad idea. Scheme, on
> the other hand, always does tail recursion where possible.
A tail-recursive function is usually easy to convert to a
loop-style iterat
On 8/20/2010 12:47 AM, News123 wrote:
On 08/20/2010 02:26 AM, Steven D'Aprano wrote:
On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
Recursion can be quite a trick to get your mind round at first
Really? Do people actually find the *concept* of recursion to be tricky?
Is this a s
Michel Claveau - MVP a écrit :
Salut !
C'est cela, la solitude du programmeur génial...
@-salutations
Moi aussi je t'aime, Michel !-)
--
http://mail.python.org/mailman/listinfo/python-list
Salut !
C'est cela, la solitude du programmeur génial...
@-salutations
--
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano a écrit :
On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
Recursion can be quite a trick to get your mind round at first
Really? Do people actually find the *concept* of recursion to be tricky?
I onced worked in a shop (Win32 desktop / accouting applications main
On Fri, Aug 20, 2010 at 12:47 AM, News123 wrote:
> On 08/20/2010 02:26 AM, Steven D'Aprano wrote:
>> On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
>>
>>> Recursion can be quite a trick to get your mind round at first
>>
>> Really? Do people actually find the *concept* of recursion to
On 20-Aug-2010, at 1:17 PM, News123 wrote:
> On 08/20/2010 02:26 AM, Steven D'Aprano wrote:
>> On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
>>
>>> Recursion can be quite a trick to get your mind round at first
>>
>> Really? Do people actually find the *concept* of recursion to be
On 08/20/2010 02:26 AM, Steven D'Aprano wrote:
> On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
>
>> Recursion can be quite a trick to get your mind round at first
>
> Really? Do people actually find the *concept* of recursion to be tricky?
Is this a sincere surprise or are you just b
On 8/19/2010 2:41 PM, Thomas Jollans wrote:
On Thursday 19 August 2010, it occurred to Baba to exclaim:
This is not recursive. In fact, it's exactly the same approach as
the first one, plus a bit of an if statement.
Right. The original poster seems to be getting their ideas
from
"http:/
On Thu, 19 Aug 2010 22:00:16 +, Martin Gregorie wrote:
> Recursion can be quite a trick to get your mind round at first
Really? Do people actually find the *concept* of recursion to be tricky?
If I remember correctly, my puzzlement about recursion lasted about 15
seconds. I remember thinkin
Thomas Jollans wrote:
[snip]
"iterate": use a loop. and again. and again. and again. and again. and aga
"recurse": consider. recurse.
This is another good one:
http://mytechquest.com/blog/wp-content/uploads/2010/05/From-a-Programming-Book.jpg
The definition for recursion looks a lot li
others, with the ideas of iterative vs.
recursive coding approaches and i was wondering what are the
advantages of each and how to best chose between both options?
I had a go at the first part of the exercise and it seems that i can
handle it. However i think my Recursive version can be improved. By
rst problem in the above assignment. The
> assignemnt deals, amongst others, with the ideas of iterative vs.
> recursive coding approaches and i was wondering what are the advantages
> of each and how to best chose between both options?
>
> I had a go at the first part of the exercise
problem in the above assignment. The
> assignemnt deals, amongst others, with the ideas of iterative vs.
> recursive coding approaches and i was wondering what are the
> advantages of each and how to best chose between both options?
>
>
With Python, I'd avoid using recursi
others, with the ideas of iterative vs.
recursive coding approaches and i was wondering what are the
advantages of each and how to best chose between both options?
I had a go at the first part of the exercise and it seems that i can
handle it. However i think my Recursive version can be improved. By
On Thursday 19 August 2010, it occurred to Baba to exclaim:
> def countSubStringMatchRecursive(target,key):
> counter=0
> fsi=0 #fsi=find string index
> if len(key)==len(target): #base case
> if key==target:
>counter+=1
> elif len(key) while fsi
ideas of iterative vs.
recursive coding approaches and i was wondering what are the
advantages of each and how to best chose between both options?
I had a go at the first part of the exercise and it seems that i can
handle it. However i think my Recursive version can be improved. By
the way, is my
46 matches
Mail list logo