Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

On a clear disk you can seek forever.


devel / comp.lang.python / Re: All permutations from 2 lists

SubjectAuthor
o Re: All permutations from 2 listsCameron Simpson

1
Re: All permutations from 2 lists

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs...@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: All permutations from 2 lists
Date: Thu, 3 Mar 2022 08:32:32 +1100
Lines: 25
Message-ID: <mailman.103.1646258407.2329.python-list@python.org>
References: <CACwCsY7piDPzzCtPy93OCdOQapBech6JMDjQijXZ0rpaiiUPqQ@mail.gmail.com>
<Yh/icMT9L6po0lij@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.uni-berlin.de HnblxGW5+kQG1WRyhtDm/wb+QAeNvoxXIoV1bXxLBcoA==
Return-Path: <cameron@cskk.id.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.011
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '2022': 0.05; 'mar': 0.07;
'cheers,': 0.11; 'import': 0.15; 'cameron': 0.16; 'expectation':
0.16; 'from:addr:cs': 0.16; 'from:addr:cskk.id.au': 0.16;
'from:name:cameron simpson': 0.16; 'itertools': 0.16; 'message-
id:@cskk.homeip.net': 0.16; 'program:': 0.16; 'received:10.10':
0.16; 'simpson': 0.16; 'subject:lists': 0.16; 'wrote:': 0.16;
'tue,': 0.19; 'to:addr:python-list': 0.20; 'skip:p 30': 0.23;
'expect': 0.28; 'header:User-Agent:1': 0.30; 'default': 0.31;
'think': 0.32; 'question': 0.32; 'empty': 0.32; 'to:name:python':
0.32; 'header:In-Reply-To:1': 0.34; 'subject:from': 0.37; 'could':
0.38; 'single': 0.39; 'list': 0.39; 'wrote': 0.39; 'want': 0.40;
'personal': 0.64; 'received:userid': 0.66; 'header:Received:6':
0.67; 'need.': 0.84; 'rob': 0.84; 'subject:All': 0.84; 'said.':
0.91
X-RG-Spam: Unknown
X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvvddruddtgedgudeghecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfupfevtfgpvffgnffuvffttedpqfgfvfenuceurghilhhouhhtmecugedttdenucenucfjughrpeffhffvuffkgggtuggjfghfsehttdertddtredvnecuhfhrohhmpeevrghmvghrohhnucfuihhmphhsohhnuceotghssegtshhkkhdrihgurdgruheqnecuggftrfgrthhtvghrnhepleevfeeghfeggfehuddvgfehhfffjeegvdeuiefhgeelgeekfeffiefguddtveehnecukfhppedurdduvdelrddvgeeirdejfeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopegsohhrghdrtghskhhkrdhhohhmvghiphdrnhgvthdpihhnvghtpedurdduvdelrddvgeeirdejfedpmhgrihhlfhhrohhmpegtrghmvghrohhnsegtshhkkhdrihgurdgruhdpnhgspghrtghpthhtohepuddprhgtphhtthhopehphihthhhonhdqlhhishhtsehphihthhhonhdrohhrgh
X-RazorGate-Vade-Verdict: clean 0
X-RazorGate-Vade-Classification: clean
X-RG-VS-CLASS: clean
X-Authentication-Info: Submitted using ID cskk@bigpond.com
Mail-Followup-To: Python <python-list@python.org>
Content-Disposition: inline
In-Reply-To: <CACwCsY7piDPzzCtPy93OCdOQapBech6JMDjQijXZ0rpaiiUPqQ@mail.gmail.com>
User-Agent: Mutt/2.2.1 (2022-02-19)
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: <Yh/icMT9L6po0lij@cskk.homeip.net>
X-Mailman-Original-References: <CACwCsY7piDPzzCtPy93OCdOQapBech6JMDjQijXZ0rpaiiUPqQ@mail.gmail.com>
 by: Cameron Simpson - Wed, 2 Mar 2022 21:32 UTC

On 02Mar2022 08:29, Larry Martell <larry.martell@gmail.com> wrote:
>On Tue, Mar 1, 2022 at 7:32 PM Rob Cliffe <rob.cliffe@btinternet.com> wrote:
>> I think itertools.product is what you need.
>> Example program:
>>
>> import itertools
>> opsys = ["Linux","Windows"]
>> region = ["us-east-1", "us-east-2"]
>> print(list(itertools.product(opsys, region)))
>
>This does not work if region = []. I wrote in question that either
>list could be empty.

What do you want to get if a list is empty? You haven't said. My
personal expectation would be an empty result.

Alternatively, if you expect an empty list to imply some single default
the the experession:

the_list or (the_default,)

might be of use.

Cheers,
Cameron Simpson <cs@cskk.id.au>


devel / comp.lang.python / Re: All permutations from 2 lists

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor