On 24/12/19 1:04 PM, Chris Angelico wrote:
On Tue, Dec 24, 2019 at 10:45 AM Marco Sulla <elbar...@gmail.com> wrote:


I encounter with cases like doing a function 6 time with no argument, or
same arguments over and over or doing some structral thing N times and I
dont know how elegant I can express that to the code.


??? Excuse me, but why you needed to call the same function SIX times? This
seems to me not elegant in primis.

Can you give us a practical example?

Taking the top/bottom six from a sorted list of occurrences.

eg in Accounts Payable, a clerk might be given the task of 'chasing' the six largest debtors (people who owe us money), as today's work assignment/priority.


File parsing. You read a section header and want to ignore that
section, so you ignore the next 15 lines.

(just to be cheeky to @Chris)

Perhaps better as a Finite State Machine, with one state being 'seeking section header'.
1 can we guarantee that the 'magic constant' of 15 will always apply?
2 presumably the total routine will involve more than identifying a single header and skipping (only) that section.
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to