Re: Tuple unpacking inside lambda expressions

2022-04-21 Thread Peter Otten
On 20/04/2022 13:01, Sam Ezeh wrote: I went back to the code recently and I remembered what the problem was. I was using multiprocessing.Pool.pmap which takes a callable (the lambda here) so I wasn't able to use comprehensions or starmap Is there anything for situations like these? Hm, I don'

Re: Tuple unpacking inside lambda expressions

2022-04-20 Thread Albert-Jan Roskam
On Apr 20, 2022 13:01, Sam Ezeh wrote: I went back to the code recently and I remembered what the problem was. I was using multiprocessing.Pool.pmap which takes a callable (the lambda here) so I wasn't able to use comprehensions or starmap Is there anything for situations

Re: Tuple unpacking inside lambda expressions

2022-04-20 Thread Sam Ezeh
I went back to the code recently and I remembered what the problem was. I was using multiprocessing.Pool.pmap which takes a callable (the lambda here) so I wasn't able to use comprehensions or starmap Is there anything for situations like these? Kind Regards, Sam Ezeh On Sat, 16 Apr 2022 at 22:

Re: Tuple unpacking inside lambda expressions

2022-04-20 Thread Sam Ezeh
This also works great! Kind Regards, Sam Ezeh On Tue, 19 Apr 2022 at 12:03, Antoon Pardon wrote: > > Op 16/04/2022 om 23:36 schreef Sam Ezeh: > > Two questions here. > > > > Firstly, does anybody know of existing discussions (e.g. on here or on > > python-ideas) relating to unpacking inside lamb

Re: Tuple unpacking inside lambda expressions

2022-04-19 Thread Antoon Pardon
Op 16/04/2022 om 23:36 schreef Sam Ezeh: Two questions here. Firstly, does anybody know of existing discussions (e.g. on here or on python-ideas) relating to unpacking inside lambda expressions? I found myself wanting to write the following. ``` map( lambda (module, data): result.process(

Re: Tuple unpacking inside lambda expressions

2022-04-16 Thread Sam Ezeh
> In general, if you're using map() with a lambda function, it's often simpler to switch to a comprehension. Oh, of course, completely went past my head. > [result.process(module, data) for module, data in jobs] And this works great, thanks! On Sat, 16 Apr 2022 at 22:42, Chris Angelico wrote:

Re: Tuple unpacking inside lambda expressions

2022-04-16 Thread Chris Angelico
On Sun, 17 Apr 2022 at 07:37, Sam Ezeh wrote: > > Two questions here. > > Firstly, does anybody know of existing discussions (e.g. on here or on > python-ideas) relating to unpacking inside lambda expressions? > > I found myself wanting to write the following. > > ``` > map( > lambda (module,

Tuple unpacking inside lambda expressions

2022-04-16 Thread Sam Ezeh
Two questions here. Firstly, does anybody know of existing discussions (e.g. on here or on python-ideas) relating to unpacking inside lambda expressions? I found myself wanting to write the following. ``` map( lambda (module, data): result.process(module, data), jobs ) ``` However, it's