is there any principle when writing python function

Emile van Sebille emile at fenx.com
Sat Aug 27 18:21:06 EDT 2011


On 8/27/2011 2:57 PM Ben Finney said...
> Emile van Sebille<emile at fenx.com>  writes:
>
>> Code is first and foremost written to be executed.
>


>      “Programs must be written for people to read, and only incidentally for
>      machines to execute.”
>      —Abelson&  Sussman, _Structure and Interpretation of Computer Programs_
>

That's certainly self-fulfilling -- code that doesn't execute will need 
to be read to be understood, and to be fixed so that it does run. 
Nobody cares about code not intended to be executed.  Pretty it up as 
much as you have free time to do so to enlighten your intended audience.

Code that runs from the offset may not ever again need to be read, so 
the only audience will ever be the processor.

I find it much to easy to waste enormous amounts of time prettying up 
code that works.  Pretty it up when it doesn't -- that's the code that 
needs the attention.

Emile



> Yes, the primary *function* of the code you write is for it to
> eventually execute. But the primary *audience* of the text you type into
> your buffer is not the computer, but the humans who will read it. That's
> what must be foremost in your mind while writing that text.
>





More information about the Python-list mailing list