Anyway, from itertools recipes:
def repeatfunc(func, times=None, *args):
"""Repeat calls to func with specified arguments.
Example: repeatfunc(random.random)
"""
if times is None:
return starmap(func, repeat(args))
return starmap(func, repeat(args, times))
On Tue, 24 Dec 2019 at 21:41, Marco Sulla <[email protected]> wrote:
>
> On Tue, 24 Dec 2019 at 01:07, Chris Angelico <[email protected]> wrote:
> > On Tue, Dec 24, 2019 at 10:45 AM Marco Sulla <...> wrote:
> > > ??? 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?
> >
> > File parsing. You read a section header and want to ignore that
> > section, so you ignore the next 15 lines.
>
> mmap and find?
>
>
> On Tue, 24 Dec 2019 at 01:35, DL Neil via Python-list
> <[email protected]> wrote:
> > Taking the top/bottom six from a sorted list of occurrences.
>
> Slicing?
--
https://mail.python.org/mailman/listinfo/python-list