On 11/10/2022 02.13, Grant Edwards wrote:
On 2022-10-10, Chris Angelico <ros...@gmail.com> wrote:
On Mon, 10 Oct 2022 at 11:52, MRAB <pyt...@mrabarnett.plus.com> wrote:
On 2022-10-10 00:40, dn wrote:
On Sun, 9 Oct 2022 at 15:39, Axy via Python-list
<python-list@python.org> wrote:
"shortest block first"
Have never heard this advice before. Kind-of rankled with me, as it did
for others.
I've followed that advice for several decades. I find it much easier
to read code that's organized that way -- particularly when the
difference in block sizes is large (e.g. the first block is one line,
and the second is a a hundred).
Makes sense. Keep the 'cause' and 'effect' close together. In other
words, making it easy to look 'up' from one of the 'suites' to see the
if-statement/condition which directs that logic-branch.
Contrarily, (see @Karsten, earlier) the preference to bundle the
"hundred" into one or more functions, rather than present as a 'wall of
text'. Added advantage: well-chosen function names(!) will remind the
reader of the purposes(!) of the "hundred".
Once both suites are short[ened], visibility improves (readability), and
the above contention goes-away. Thus the sense of the condition becomes
the most worthy consideration.
--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list