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
On Tue, 24 Dec 2019 at 01:07, Chris Angelico 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
o a language that does not need more bloat.
-----Original Message-
From: Python-list On
Behalf Of DL Neil via Python-list
Sent: Monday, December 23, 2019 7:27 PM
To: Python
Subject: Re: Most elegant way to do something N times
On 24/12/19 1:04 PM, Chris Angelico wrote:
> On Tue, Dec 2
r 23, 2019 6:12 PM
To: Batuhan Taskaya
Cc: Ian Kelly ian.g.kelly-at-gmail.com |python-list@python.org|
Subject: Re: Most elegant way to do something N times
>
> I encounter with cases like doing a function 6 time with no argument,
> or same arguments over and over or doing some stru
On Tue, Dec 24, 2019 at 11:34 AM DL Neil via Python-list
wrote:
>
> On 24/12/19 1:04 PM, Chris Angelico wrote:
> > 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 Ma
On 24/12/19 1:04 PM, Chris Angelico wrote:
On Tue, Dec 24, 2019 at 10:45 AM Marco Sulla 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 cod
It depends on what's elegant, and beauty is in the eye of the beholder..
def recurse(n):
print(”do be do be do”)
if n>0: recurse(n-1)
Regards,
Morten
søn. 22. des. 2019, 21:37 skrev Batuhan Taskaya :
> I encounter with cases like doing a function 6 time with no argument, or
> same argument
On Tue, Dec 24, 2019 at 10:45 AM Marco Sulla 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 w
>
> 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
Le 22/12/2019 à 23:50, Stefan Ram a écrit :
Batuhan Taskaya writes:
dont like this for _ in range(n): do() thing. Any suggestions?
The participants of my beginner classes like to write:
n * do()
for that purpose, but usuallythis does not work as intended!
What would work sometimes
On 2019-12-22 23:34, Batuhan Taskaya 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. I dont know why but I dont like this
>
> for _
Am 22.12.2019 um 21:34 schrieb Batuhan Taskaya:
> 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. I dont know why but I
> dont like this for _
On 12/22/19 3:34 PM, Batuhan Taskaya 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. I dont know why but I
> dont like this for _ in r
13 matches
Mail list logo