Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Vulcans worship peace above all. -- McCoy, "Return to Tomorrow", stardate 4768.3


devel / comp.lang.python / Re: Tuple unpacking inside lambda expressions

SubjectAuthor
o Re: Tuple unpacking inside lambda expressionsSam Ezeh

1
Re: Tuple unpacking inside lambda expressions

<mailman.166.1650452498.20749.python-list@python.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=17932&group=comp.lang.python#17932

 copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: sam.z.e...@gmail.com (Sam Ezeh)
Newsgroups: comp.lang.python
Subject: Re: Tuple unpacking inside lambda expressions
Date: Wed, 20 Apr 2022 12:01:23 +0100
Lines: 50
Message-ID: <mailman.166.1650452498.20749.python-list@python.org>
References: <CAD+b3HjYMw0v+wQCGC5Ux9G-xUPnP-HWc7SPaWD668fbLGaV6A@mail.gmail.com>
<CAD+b3HjW8drFi4bxzK2XQSxWOLkQtsnXnyPFv6iHt5npXOBzcg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de LfyZCf4PE0VPV9MVi14MRAH9OvfZD6LuN3HnAoeyRPIg==
Return-Path: <sam.z.ezeh@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=JM7jwJv3;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.025
X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; '(e.g.': 0.05; '2022':
0.05; 'wanting': 0.07; 'go-to': 0.09; 'situations': 0.09;
'following.': 0.16; 'lambda': 0.16; 'syntax.': 0.16; 'unpacking':
0.16; 'wrote:': 0.16; 'problem': 0.16; 'python': 0.16; 'to:addr
:python-list': 0.20; 'sat,': 0.22; 'code': 0.23; 'anything': 0.25;
"wasn't": 0.26; 'recently': 0.29; 'code,': 0.31; 'takes': 0.31;
'anybody': 0.32; 'discussions': 0.32; 'maintaining': 0.32;
'received:209.85.214': 0.32; 'message-id:@mail.gmail.com': 0.32;
'but': 0.32; 'there': 0.33; 'able': 0.34; 'header:In-Reply-To:1':
0.34; 'received:google.com': 0.34; 'felt': 0.35; 'meaning': 0.35;
'following': 0.35; 'from:addr:gmail.com': 0.35; 'using': 0.37;
"it's": 0.37; 'received:209.85': 0.37; 'received:209': 0.39;
'two': 0.39; 'use': 0.39; 'methods': 0.39; 'potential': 0.60;
'here.': 0.61; 'here': 0.62; 'skip:m 20': 0.63; 'skip:r 20': 0.64;
'less': 0.65; 'back': 0.67; 'received:209.85.214.195': 0.84;
'received:mail-pl1-f195.google.com': 0.84; 'was.': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=nsnIdpuujp+bk9YTh+AziASTqrih8FjXinURSz7B0/A=;
b=JM7jwJv3GwRSAhsFwuKjakv+0bq5zfbf1YqjaYhawenyKuZgO5nOi2psMyZn+lf7AW
E8yXF6lUBf/Si2guLzYBKiu8yf+sGU5km3up29ejYV9jemHcULEjekQ9LPT9CkBIBP1/
6KYcGJ2Pcn80dNhkFBR00r1ybs2LF0Ea4aCFTSOq0CJfeOih2hR8j/BLq+Q4ixh+Y1qN
CSyq5G1tTdY1V+jluPb49YkIUHCSbYH6r50vtD22+IyqJCTtaRAVi69WZLtqdqYmyKnp
2/LQRbQFOC0i9Tls8DUpHgToiSouwOWMKY8GOzUml6Ek4y7wYqWAx3aiz/PqYlKxgAay
oC0w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=nsnIdpuujp+bk9YTh+AziASTqrih8FjXinURSz7B0/A=;
b=e060C4WwFO/spc3Tv2TPOdT52gXaOgOfv5fhpE/0A763COOZ06iKpsoWAhZvRnJrDz
0GjF0vnGGyzE9q0dcipHXFVxoYfBGMO8J66PbgSKj0Ym1O3PiUpU4ySYfO1Ov0RWy6dl
NqbYU/3DHBIFpF6p8tkKQatRFS+pKCducUx7sX1p5S3dwamTqS4SSipuLTlOj2L9fiLi
4axHPYHzCQN0jwERVkyJkgGtd2LKH6W9HE6SNzjZ+2vQkC/clmKpLriR/hiEPUy1Mf3j
OdlcbBADc7IuV8n9yeOtt977qgh6ZTMO3A4eW4hlOd2PC2XYhStb2JXrMN+oMme7xAeQ
4okw==
X-Gm-Message-State: AOAM530CEfqc7J26xUYN4OzAJQot1bUDJypeudJ+S2VmWUvf7qRY/9t8
W+oUBE29k7nk5BQdOP9ekORvIcftiN+rAWq7cWPcNME1IOg=
X-Google-Smtp-Source: ABdhPJxisbvT+6aGEVGAQXzyQR2QkO1Mh8iRpp2FFBp80envE3JlwE4YE+nRDVy9BCyLnmC8JFhJUphSyWH7mkmm584=
X-Received: by 2002:a17:902:f78d:b0:14d:522e:deb3 with SMTP id
q13-20020a170902f78d00b0014d522edeb3mr19838943pln.173.1650452494923; Wed, 20
Apr 2022 04:01:34 -0700 (PDT)
In-Reply-To: <CAD+b3HjYMw0v+wQCGC5Ux9G-xUPnP-HWc7SPaWD668fbLGaV6A@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAD+b3HjW8drFi4bxzK2XQSxWOLkQtsnXnyPFv6iHt5npXOBzcg@mail.gmail.com>
X-Mailman-Original-References: <CAD+b3HjYMw0v+wQCGC5Ux9G-xUPnP-HWc7SPaWD668fbLGaV6A@mail.gmail.com>
 by: Sam Ezeh - Wed, 20 Apr 2022 11:01 UTC

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:36, Sam Ezeh <sam.z.ezeh@gmail.com> 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, data): result.process(module, data),
> jobs
> )
> ```
> However, it's of course not legal Python syntax.
>
> The following were potential options but I felt they removed some of
> the meaning from the code, making it less understandable for other
> people.
>
> ```
> map(
> lambda job: result.process(job[0], job[1]),
> jobs
> )
> ```
>
> ```
> map(
> lambda job: result.process(*job),
> jobs
> )
> ```
>
> Secondly, for situations like these, do you have any go-to methods of
> rewriting these while maintaining clarity?
>
> Kind Regards,
> Sam Ezeh

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor