Fibonacci series recursion error

Hans Georg Schaathun hg at schaathun.net
Tue May 3 03:01:35 EDT 2011


On Tue, 3 May 2011 07:56:26 +1000, Chris Angelico
  <rosuav at gmail.com> wrote:
: > often recursively.  The compiler should generate code the way the CPU
: > thinks (most optimally), i.e. iteratively.
: 
:  The CPU can function iteratively or recursively.

I should have said 'hardware' rather than CPU.  Iteratively it is not
as optimal as the call contexts have to be stored.

:  But in my opinion, the programmer and the interpreter/compiler are
:  teammates. If you allow programmers to be stupid, you will get a lot
:  of stupid programmers writing code. (I think that's one of PHP's
:  biggest downsides.) If the human and the machine know each other well
:  enough, the resulting code can be orders of magnitude more efficient
:  to run, *without taking any more tme to code* because the programmer
:  already knew the right things to do.

There are situations where that team is essential.  However, in many
more situation, the programmer has to team primarily with domain
experts and work with a language in which the domain expert is fluent.
The compiler and hardware are slaves of the engineers, and extra staff
to team up with the compiler is an added cost and delay.

:  Perhaps it will take you four hours to read through something, study
:  it, maybe eyeball the compiler's source code, maybe do some
:  disassembly. If you have a few years of career ahead of you, you'll
:  benefit many times over from those few hours, and without spending
:  extra time, you'll produce better code. THAT is what distinguishes the
:  master from the novice.

That depends on /what/ your career is, and what you need to master.

-- 
:-- Hans Georg



More information about the Python-list mailing list