Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

<wiggy> bwah, vodka in my mouse


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

SubjectAuthor
o Re: All permutations from 2 lists2QdxY4RzWzUUiLuE

1
Re: All permutations from 2 lists

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: 2QdxY4Rz...@potatochowder.com
Newsgroups: comp.lang.python
Subject: Re: All permutations from 2 lists
Date: Tue, 1 Mar 2022 18:20:16 -0600
Lines: 21
Message-ID: <mailman.80.1646180427.2329.python-list@python.org>
References: <CACwCsY4EQHJLr3k6G5nKdxp+Z0z_-gOLCFFtyEyDiAzym70xeA@mail.gmail.com>
<Yh64QGJVQllpgenC@scrozzle>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.uni-berlin.de 2egGKan6bg7RVb/Qd9wCzgXjpYrU49wpH0IgMnYhIg/g==
Return-Path: <2QdxY4RzWzUUiLuE@potatochowder.com>
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.008
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; ';-)': 0.07; 'received:78':
0.09; 'import': 0.15; 'from:addr:2qdxy4rzwzuuilue': 0.16;
'from:addr:potatochowder.com': 0.16; 'itertools': 0.16; 'length.':
0.16; 'message-id:@scrozzle': 0.16; 'received:136.243': 0.16;
'received:78.46': 0.16; 'received:78.46.172': 0.16;
'received:www458.your-server.de': 0.16; 'received:your-server.de':
0.16; 'subject:lists': 0.16; 'tuples': 0.16; 'wrote:': 0.16;
'to:addr:python-list': 0.20; 'received:de': 0.23; "i'd": 0.24;
'tried': 0.26; 'lists,': 0.32; 'received:136': 0.32; 'but': 0.32;
'header:In-Reply-To:1': 0.34; 'lists': 0.37; 'subject:from': 0.37;
'really': 0.37; "it's": 0.37; 'list': 0.39; 'feel': 0.63; 'free':
0.72; 'need.': 0.84; 'received:70': 0.84; 'subject:All': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <CACwCsY4EQHJLr3k6G5nKdxp+Z0z_-gOLCFFtyEyDiAzym70xeA@mail.gmail.com>
X-Authenticated-Sender: 2QdxY4RzWzUUiLuE@potatochowder.com
X-Virus-Scanned: Clear (ClamAV 0.103.5/26468/Tue Mar 1 10:31:38 2022)
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: <Yh64QGJVQllpgenC@scrozzle>
X-Mailman-Original-References: <CACwCsY4EQHJLr3k6G5nKdxp+Z0z_-gOLCFFtyEyDiAzym70xeA@mail.gmail.com>
 by: 2QdxY4Rz...@potatochowder.com - Wed, 2 Mar 2022 00:20 UTC

On 2022-03-01 at 19:12:10 -0500,
Larry Martell <larry.martell@gmail.com> wrote:

> If I have 2 lists, e.g.:
>
> os = ["Linux","Windows"]
> region = ["us-east-1", "us-east-2"]
>
> How can I get a list of tuples with all possible permutations?
>
> So for this example I'd want:
>
> [("Linux", "us-east-1"), ("Linux", "us-east-2"), ("Windows",
> "us-east-1"), "Windows", "us-east-2')]
>
> The lists can be different lengths or can be 0 length. Tried a few
> different things with itertools but have not got just what I need.

[(o, r) for o in os for r in region]

Feel free to import itertools, but it's not really necessary. ;-)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor