Re: Timezone jokes (was: All permutations from 2 lists)

2022-03-03 Thread Avi Gross via Python-list
: Chris Angelico To: python-list@python.org Sent: Thu, Mar 3, 2022 12:40 pm Subject: Re: Timezone jokes (was: All permutations from 2 lists) On Fri, 4 Mar 2022 at 03:29, Tim Chase wrote: > > On 2022-03-03 06:27, Grant Edwards wrote: > > On 2022-03-03, Chris Angelico wrote: > > &

Re: Timezone jokes (was: All permutations from 2 lists)

2022-03-03 Thread Chris Angelico
On Fri, 4 Mar 2022 at 03:29, Tim Chase wrote: > > On 2022-03-03 06:27, Grant Edwards wrote: > > On 2022-03-03, Chris Angelico wrote: > > > Awww, I was going to make a really bad joke about timezones :) > > > > As opposed to all the really good jokes about timezones... ;) > > And here I thought yo

Re: All permutations from 2 lists

2022-03-03 Thread Avi Gross via Python-list
It is clear that was not quite your real need. -Original Message- From: Larry Martell To: Avi Gross Cc: python-list@python.org Sent: Thu, Mar 3, 2022 9:07 am Subject: Re: All permutations from 2 lists On Wed, Mar 2, 2022 at 9:42 PM Avi Gross via Python-list wrote: > >

Re: Timezone jokes (was: All permutations from 2 lists)

2022-03-03 Thread Tim Chase
On 2022-03-03 06:27, Grant Edwards wrote: > On 2022-03-03, Chris Angelico wrote: > > Awww, I was going to make a really bad joke about timezones :) > > As opposed to all the really good jokes about timezones... ;) And here I thought you were just Trolling with timezones... https://en.wikipedi

Re: All permutations from 2 lists

2022-03-03 Thread Rob Cliffe via Python-list
On 03/03/2022 14:07, Larry Martell wrote: On Wed, Mar 2, 2022 at 9:42 PM Avi Gross via Python-list wrote: Larry, i waited patiently to see what others will write and perhaps see if you explain better what you need. You seem to gleefully swat down anything offered. So I am not tempted to

Re: All permutations from 2 lists

2022-03-03 Thread Grant Edwards
On 2022-03-03, Chris Angelico wrote: > On Thu, 3 Mar 2022 at 13:05, gene heskett wrote: >> I take it back, kmail5 had decided it was a different thread. My bad, no >> biscuit. >> > > Awww, I was going to make a really bad joke about timezones :) As opposed to all the really good jokes about time

Re: All permutations from 2 lists

2022-03-03 Thread Larry Martell
On Wed, Mar 2, 2022 at 9:42 PM Avi Gross via Python-list wrote: > > Larry, > > i waited patiently to see what others will write and perhaps see if you > explain better what you need. You seem to gleefully swat down anything > offered. So I am not tempted to engage. But then you gave in to the t

Re: All permutations from 2 lists

2022-03-02 Thread Avi Gross via Python-list
Larry, i waited patiently to see what others will write and perhaps see if you explain better what you need. You seem to gleefully swat down anything offered. So I am not tempted to engage. Some later messages suggest you may not be specifying quite what you want. It sounds like you are asking

Re: All permutations from 2 lists

2022-03-02 Thread Chris Angelico
On Thu, 3 Mar 2022 at 13:05, gene heskett wrote: > I take it back, kmail5 had decided it was a different thread. My bad, no > biscuit. > Awww, I was going to make a really bad joke about timezones :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: All permutations from 2 lists

2022-03-02 Thread gene heskett
On Wednesday, 2 March 2022 10:49:11 EST Larry Martell wrote: > On Wed, Mar 2, 2022 at 10:26 AM Antoon Pardon wrote: > > Op 2/03/2022 om 15:58 schreef Larry Martell: > > > On Wed, Mar 2, 2022 at 9:37 AM Antoon Pardon wrote: > > > If one list is empty I want just the other list. What I am > >

Re: All permutations from 2 lists

2022-03-02 Thread gene heskett
On Wednesday, 2 March 2022 17:46:49 EST Larry Martell wrote: > On Wed, Mar 2, 2022 at 5:31 PM Joel Goldstick wrote: > > On Wed, Mar 2, 2022 at 5:07 PM Larry Martell wrote: > > > On Wed, Mar 2, 2022 at 5:00 PM Cameron Simpson wrote: > > > > On 02Mar2022 08:29, Larry Martell wrote: > > > > >O

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 5:31 PM Joel Goldstick wrote: > > On Wed, Mar 2, 2022 at 5:07 PM Larry Martell wrote: > > > > On Wed, Mar 2, 2022 at 5:00 PM Cameron Simpson wrote: > > > > > > On 02Mar2022 08:29, Larry Martell wrote: > > > >On Tue, Mar 1, 2022 at 7:32 PM Rob Cliffe > > > >wrote: > > >

Re: All permutations from 2 lists

2022-03-02 Thread Joel Goldstick
On Wed, Mar 2, 2022 at 5:07 PM Larry Martell wrote: > > On Wed, Mar 2, 2022 at 5:00 PM Cameron Simpson wrote: > > > > On 02Mar2022 08:29, Larry Martell wrote: > > >On Tue, Mar 1, 2022 at 7:32 PM Rob Cliffe > > >wrote: > > >> I think itertools.product is what you need. > > >> Example program: >

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 5:00 PM Cameron Simpson wrote: > > On 02Mar2022 08:29, Larry Martell wrote: > >On Tue, Mar 1, 2022 at 7:32 PM Rob Cliffe wrote: > >> I think itertools.product is what you need. > >> Example program: > >> > >> import itertools > >> opsys = ["Linux","Windows"] > >> region =

Re: All permutations from 2 lists

2022-03-02 Thread Cameron Simpson
On 02Mar2022 08:29, Larry Martell wrote: >On Tue, Mar 1, 2022 at 7:32 PM Rob Cliffe 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)

Re: All permutations from 2 lists

2022-03-02 Thread Om Joshi
Something like this?itertools.product(x or ("",) for x in perm_elems)Out of curiousity, how might one adapt this if x is not a list but an iterator, without doing `itertools.product(list(x) or ("",) for x in perm_elems)`?  On Wed, 02 Mar 2022 09:25:42 -0600 antoon.par...@vub.be wrote

Re: All permutations from 2 lists

2022-03-02 Thread Om Joshi
I sent this 17hrs ago but I guess it just went through. Apologies for the redundant comments... On Tue, 01 Mar 2022 18:57:02 -0600 om+pyt...@omajoshi.com wrote For completeness, the itertools solution (which returns an iterator) is >>> os = ["Linux","Windows"] >>> region = ["us-east-

Re: All permutations from 2 lists

2022-03-02 Thread Om Joshi
For completeness, the itertools solution (which returns an iterator) is >>> os = ["Linux","Windows"] >>> region = ["us-east-1", "us-east-2"] >>> import itertools >>> itertools.product(os,region) >>> list(itertools.product(os,region)) [('Linux', 'us-east-1'), ('Linux', 'us-east-2'), ('Windows', 'u

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 10:26 AM Antoon Pardon wrote: > > > > Op 2/03/2022 om 15:58 schreef Larry Martell: > > On Wed, Mar 2, 2022 at 9:37 AM Antoon Pardon wrote: > >> > > If one list is empty I want just the other list. What I am doing is > > building a list to pass to a mongodb query. If

Re: All permutations from 2 lists

2022-03-02 Thread Antoon Pardon
Op 2/03/2022 om 15:58 schreef Larry Martell: On Wed, Mar 2, 2022 at 9:37 AM Antoon Pardon wrote: If one list is empty I want just the other list. What I am doing is building a list to pass to a mongodb query. If region is empty then I want to query for just the items in the os list. I gues

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 9:37 AM Antoon Pardon wrote: > > > > Op 2/03/2022 om 15:29 schreef Larry Martell: > > On Wed, Mar 2, 2022 at 9:10 AM Antoon Pardon wrote: > >> Op 2/03/2022 om 14:44 schreef Larry Martell: > >>> On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon > >>> wrote: > Op 2/03/2022

Re: All permutations from 2 lists

2022-03-02 Thread Antoon Pardon
Op 2/03/2022 om 15:29 schreef Larry Martell: On Wed, Mar 2, 2022 at 9:10 AM Antoon Pardon wrote: Op 2/03/2022 om 14:44 schreef Larry Martell: On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: Op 2/03/2022 om 14:27 schreef Larry Martell: On Tue, Mar 1, 2022 at 7:21 PM<2qdxy4rzwzuui...@

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 9:10 AM Antoon Pardon wrote: > > Op 2/03/2022 om 14:44 schreef Larry Martell: > > On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: > >> > >> Op 2/03/2022 om 14:27 schreef Larry Martell: > >>> On Tue, Mar 1, 2022 at 7:21 PM<2qdxy4rzwzuui...@potatochowder.com> > >>> wro

Re: All permutations from 2 lists

2022-03-02 Thread Antoon Pardon
Op 2/03/2022 om 14:44 schreef Larry Martell: On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: Op 2/03/2022 om 14:27 schreef Larry Martell: On Tue, Mar 1, 2022 at 7:21 PM<2qdxy4rzwzuui...@potatochowder.com> wrote: On 2022-03-01 at 19:12:10 -0500, Larry Martell wrote: If I have 2 list

Re: All permutations from 2 lists

2022-03-02 Thread Joel Goldstick
On Wed, Mar 2, 2022 at 9:01 AM Larry Martell wrote: > > On Wed, Mar 2, 2022 at 8:54 AM Joel Goldstick > wrote: > > > > On Wed, Mar 2, 2022 at 8:46 AM Larry Martell > > wrote: > > > > > > On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: > > > > > > > > > > > > Op 2/03/2022 om 14:27 schreef

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 8:54 AM Joel Goldstick wrote: > > On Wed, Mar 2, 2022 at 8:46 AM Larry Martell wrote: > > > > On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: > > > > > > > > > Op 2/03/2022 om 14:27 schreef Larry Martell: > > > > On Tue, Mar 1, 2022 at 7:21 PM<2qdxy4rzwzuui...@potatoch

Re: All permutations from 2 lists

2022-03-02 Thread Joel Goldstick
On Wed, Mar 2, 2022 at 8:46 AM Larry Martell wrote: > > On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: > > > > > > Op 2/03/2022 om 14:27 schreef Larry Martell: > > > On Tue, Mar 1, 2022 at 7:21 PM<2qdxy4rzwzuui...@potatochowder.com> wrote: > > >> On 2022-03-01 at 19:12:10 -0500, > > >> Larr

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Wed, Mar 2, 2022 at 8:37 AM Antoon Pardon wrote: > > > Op 2/03/2022 om 14:27 schreef Larry Martell: > > On Tue, Mar 1, 2022 at 7:21 PM<2qdxy4rzwzuui...@potatochowder.com> wrote: > >> On 2022-03-01 at 19:12:10 -0500, > >> Larry Martell wrote: > >> > >>> If I have 2 lists, e.g.: > >>> > >>> os

Re: All permutations from 2 lists

2022-03-02 Thread Antoon Pardon
Op 2/03/2022 om 14:27 schreef Larry Martell: On Tue, Mar 1, 2022 at 7:21 PM<2qdxy4rzwzuui...@potatochowder.com> wrote: On 2022-03-01 at 19:12:10 -0500, Larry Martell 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 tuple

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Tue, Mar 1, 2022 at 7:32 PM Rob Cliffe wrote: > > I would not use `os` as an identifier, as it is the name of an important > built-in module. This is part of a much larger data structure, I created a simplified example. It is not actually called os. > I think itertools.product is what you nee

Re: All permutations from 2 lists

2022-03-02 Thread Larry Martell
On Tue, Mar 1, 2022 at 7:21 PM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2022-03-01 at 19:12:10 -0500, > Larry Martell 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 pe

Re: All permutations from 2 lists

2022-03-02 Thread Chris Angelico
On Wed, 2 Mar 2022 at 19:34, Peter Otten <__pete...@web.de> wrote: > > On 02/03/2022 01:32, Rob Cliffe via Python-list wrote: > > > itertools.product returns an iterator (or iterable, I'm not sure of the > > correct technical term). > > There's a simple test: > > iter(x) is x --> True # iterator >

Re: All permutations from 2 lists

2022-03-02 Thread Peter Otten
On 02/03/2022 01:32, Rob Cliffe via Python-list wrote: itertools.product returns an iterator (or iterable, I'm not sure of the correct technical term). There's a simple test: iter(x) is x --> True # iterator iter(x) is x --> False # iterable So: >>> from itertools import product >>> p =

Re: All permutations from 2 lists

2022-03-01 Thread Rob Cliffe via Python-list
I would not use `os` as an identifier, as it is the name of an important built-in module. 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))) Output: [('Linux

Re: All permutations from 2 lists

2022-03-01 Thread 2QdxY4RzWzUUiLuE
On 2022-03-01 at 19:12:10 -0500, Larry Martell 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-e

All permutations from 2 lists

2022-03-01 Thread Larry Martell
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 b