[Devel] >> Why do we need one more indent here instead of returning 1 in the

Igor M Podlesny openvz at poige.ru
Tue May 7 03:26:07 PDT 2013


On 7 May 2013 18:17, Igor M Podlesny <openvz at poige.ru> wrote:
> On 7 May 2013 16:36, Andrew Vagin <avagin at parallels.com> wrote:
[...]
>> Why do we need one more indent here instead of returning 1 in the
>> previous block? I am not sure that this version is more readable...

   1) Single return point is easier to debug than if a function has a
lots of exit ways:
you can set a break-point on it, or debug statement, or whatever.

   2) It's structural programming. Long ago people got used to GOTO
and then some of
them realized it's more readable to have code text indented according
to execution flow.
In this very case, there's obviously no problem with indentation level
-- it's quite decent.
Yep, 2 is more than 1, but there's no drama in that — it's better to
have extra return
abandoned.

--




More information about the Devel mailing list