Russel Winder <rus...@winder.org.uk> Wrote in message:
> On Thu, 2014-02-06 at 18:06 -0500, Dave Angel wrote:
> […]
>> 
>> Code:
>> def fib2(n):
>>      if n==1:
>>              return 1
>> 
>>      elif n==2:
>>              return 1
>>      else:
>>              return fib2(n-2) +fib2(n-1)
> […]
> 
> I suggest it also be pointed out that this form is algorithmically
> dreadful. Having transformed the maths to this first cut code, we then
> need to consider it as code and shift to a tail recursive form,
> iterative form, or at the very least memoize the function. Leaving
> students of programming (in any current language) with the idea that
> this is a good final solution is, I believe, a disservice. 
> 
>
Not as bad as attributing that code to me.



-- 
DaveA

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to