Coding style

Antoon Pardon apardon at forel.vub.ac.be
Sun Jul 23 05:01:45 EDT 2006


On 2006-07-21, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On 21 Jul 2006 12:00:43 GMT, Antoon Pardon <apardon at forel.vub.ac.be>
> declaimed the following in comp.lang.python:
>
>> So we have code with certain shudder characteristics. And instead
>> of trying to help the OP with his problem, some people react
>> to the shudder and come with all sort of comments that might be
>> true if the code as shown was production code, but which totally
>> miss the point the code was illustrating and thus aren't much
>> helpfull.
>
> 	You miss one factor -- the specification of what the code sample is
> supposed to handle. Showing a sample of code which may reproduce an
> apparent problem, without stating /all/ the requirements of the
> data/process, leaves the reviewer in the state of assuming all the
> conditions are explicit in the code.

No that leaves the reviewer in the state of assuming all *relevant*
conditions are explicit in the code.

> And in the case of your sample --
> that just isn't true. The try/except block is too general, and seems to
> imply that the exception might be raised in either (or both) foo() or
> bar()

Which in this case is totally irrelevant. The try/except block
was not part of the code that would have been posetd to the
newsgroup.

> -- it is not clear that the try/except is being used to detect an
> unstated exit condition requirement.

Again irrelevant. This was an example where someone had trouble
with his code (the try/except statement) which he would then
reduce to a minimal piece of code that would still show the 
trouble some behaviour (Just the then part of an if statement)
which he would then post to the list.

All trouble with the so called original code is totally irrelevant
to the point I was trying to make and the more you try to critisize
it the more you are an illustration of the point I am trying to make.

This remark was just under that example code in my originle
article:

  This code makes the distinction between the three possibilities,
  whether it is a good way or not I won't discuss, this is just
  meant as an illustration. 

What didn't you understand about the code just meant to be an
illustration.

-- 
Antoon Pardon



More information about the Python-list mailing list