I'm having a function that I want to evaluate with different parameter combinations, e.g.  params1 = [1, 6, 100] params2 = [True, False] params3 = ["blue", "red", "green"]   Here is my straight forward attempt to do this:  res = np.zeros((len(params1), len(params2), len(params3)))  for i1, p1 in enumerate(params1):     for i2, p2 in enumerate(params2):         for i3, p3 in enumerate(params3):             res[i1, i2, i3] = myfunc(p1,p2,p3)   This works, but adapting it to more complex scenarios is not only cumbersome but more importantly makes the code messy and thus increases the chance of mistakes.  My next approach to handle this in a more structured way would be to write a recursive function that would starts one for loop in one parameter and then inside this loop call itself.  But since my problem seems like a quite general problem, I wonder if there is a better (e.g. more basic or neat) way to address this.  EDIT: Thanks for the helpful comments. It was suggested to use for params in itertools.product(params1, params2, params3): myfunc(*params).  Unfortunately does not do the trick for me, since I also need the indices. I edited my code, since this crucial part was missing.  I should also give more background on what I want to use this for, since this seems like a standard problem to me and there might be completely different approaches: I want to evaluate the numeric output of myfunc in some part of it's high dimensional parameter space, to later explore it and in particular look for maxima and minima under constraints (e.g. minima for parameter2 = True). Therefor my approach was to evaluate it in that part of the space and store the result in the numpy array res.  Again, thanks a lot for any suggestions.
How can I get the Cartesian product (every possible combination of values) from a group of lists?  Input:   somelists = [    [1, 2, 3],    ['a', 'b'],    [4, 5] ]   Desired output:  [(1, 'a', 4), (1, 'a', 5), (1, 'b', 4), (1, 'b', 5), (2, 'a', 4), (2, 'a', 5) ...]
How to validate an email address in JavaScript How can I start automatically a command on Ubuntu 18.04? Programmatically get own phone number in iOS Is there any way to get own phone number by standard APIs from iPhone SDK? Group of order $8p$ is solvable, for any prime $p$ Consider the following question:     Show that a group $G$ of order $8p$ is solvable, for any prime $p$.   I am kind of stuck, but here are my first attempts:  I chose the series of subroups $G&gt;H_8&gt;H_4&gt;H_2&gt;H_1=\{e\}$ where $H_k$ has order $k$. All of these subgroups exist due to Sylow's Theorems. We have the quotients $H_8/H_4\cong H_4/H_2 \cong H_2/H_1 \cong \mathbb Z/2\mathbb Z$, so $G&gt;H_8\rhd H_4\rhd H_2\rhd H_1=\{e\}$. Only the factor $G/H_8 \cong \mathbb Z/p\mathbb Z$ is causing me a headache, because although its of prime order (and hence abelian) I don't know whether $H_8$ is normal in $G$ (unless $p=2$).  If $p\ne 2$, then the number $k$ of Sylow $2$-subgroups is $1$ mod $2$. Since $k$ divides $|G|$ we might have $k=1$ or $k=p$. If we had $k=1$ then $H_8$ would be the only Sylow $2$-subgroup (and hence normal in $G$). But how could we show this?  Or is there even an easier way to approach this problem?  $\ $  edit: I am going to try a different approach: The case $p=2$ is clear. When $p=3$ or $p=7$ the group has order 24 or 56 and since the smallest simple non-abelian group has order 60, the group must also be solvable in these exceptional cases (as Mariano pointed out).  In any other case we get a Sylow $p$-subgroup $H_p$ of order $p$, which is is normal in $G$. The quotient $G/H_p$ has order $8=2^3$; and prime power order implies solvable. So $G/H_p$ is solvable and $H_p$ is also solvable. And since the composition factors of $G$ are those of $H_p$ together with those of $G/H_p$, we conclude that $G$ is solvable iff $H_p$ and $G/H_p$ are solvable, which is the case. Hence $G$ is solvable if $|G|=8p$. Tell rate-limited users how long they have to wait before asking a new question New users are limited to one question per an hour, but once they'll hit this limit, all they see is You can only post once every 60 minutes. I think it would be very appreciate to change / extend this message, adding You need to wait next xx minutes. I saw similar solutions on many forums.  Would it be hard to implement something like that?  EDIT: It could be either added as extension to above mentioned warning message or as red-colored reminder above Title field. Or even as an explanation message, preventing user from clicking on a Ask Question button? Anything would be good, to not let user write the question (can be time consuming) only to hit the wall of limit. This can be a little bit annoying or frustrating, don't you think? Trying to install Steam ERROR: You are missing the following 32-bit libraries, and Steam may not run: not I've already installed Steam, but when I click on the program I get this message  ERROR- You are missing the following 32-bit libraries, and Steam may not run: not   I don't know what to install or even do. Is it okay to board only the second flight of a return ticket? The return ticket is much cheaper than buying one way I was browsing flight price at Singapore Airlines website, and a one-way flight from SIN to SFO cost this much:    That's quite expensive. I tried browsing around and found that a return flight from SFO to SIN and back to SFO cost much cheaper:    It's really weird because the second ticket includes the exact same flight that cost 1900+, but it's almost half the price. The reason for this counter-intuitive situation is explained in the answers this question   If I am located in Singapore and my intention is to fly one-way to SFO, is it safe to book the flight in the second picture and only board SFO-SIN leg? Will they deny me because I miss the SIN-SFO flight? Generate four random words from a list for XKCD-like passwords For start, we know how can we output random lines from a txt file:   perl -MList::Util -e 'print List::Util::shuffle &lt;&gt;' words.txt   But we need a general solution (perl is usually installed on every unix-like OS) to output 4 random words from a txt file, how can we do it?    $ cat words.txt ... alpha beta gamma delta epsilon ... $   The "..." represents many other words.   Example output (without newline between them, but one unix newline is needed at the end, spaces should separate them):  $ perl SOMEMAGIC words.txt gamma alpha delta beta $   Using only perl, the shortest possible solution (oneliner).   It will be used as human memorable password generator:    Since afaik perl is enough good to be named "random generator".   Example common english wordlist with 32768 unique lines: A student is applying to a PhD program in Computer Sciences at Harvard and MIT. He estimates that he has two out of three chances of being accepted at Harvard and two out of five chances at MIT. He further estimates the probability that he will be accepted by both has probability of one to five. What is the probability that he is accepted by MIT if he is accepted by Harvard? Is the event "accepted by MIT" independent of the event "accepted by Harvard".  I don't understand if these are odds or probabilities What's the projective limit of these polynomial rings ? Define an inverse system of polynomial rings over a commutative ring $k$ by the canonical projection $k[x_1,...,x_n] \to k[x_1,...,x_m]\;(m&lt; n)$.   Question: What is the projective limit $\varprojlim_n k[x_1,...,x_n]$ ? I want to export my objects to unity, but in blender I`m using Eevee engine. However the light in rendered more and material preview mode is completely different, which impacts the colors of objects. Which one can i trust to see the true final colors of the objects so that they will be the same when i export them to unity? If $\vec{a},\vec{b},\vec{c},\vec{d}$are unit vectors, $(\vec{a}\times\vec{b}).(\vec{c}\times\vec{d})=1$ and $\vec{a}.\vec{c}=\frac{1}{2}$,then If $\vec{a},\vec{b},\vec{c},\vec{d}$are unit vectors such that $(\vec{a}\times\vec{b}).(\vec{c}\times\vec{d})=1$ and $\vec{a}.\vec{c}=\frac{1}{2}$,then $(A)\vec{a},\vec{b},\vec{c}$ are non-coplanar $(B)\vec{a},\vec{b},\vec{d}$ are non-coplanar $(C)\vec{b},\vec{d}$ are non-parallel. $(D)\vec{a},\vec{d}$ are parallel and $\vec{b}$ and $\vec{c}$ are parallel.    My Attempt: $(\vec{a}\times\vec{b}).(\vec{c}\times\vec{d})=1$ $(\vec{a}.\vec{c})(\vec{b}.\vec{d})-(\vec{a}.\vec{d})(\vec{b}.\vec{c})=1$ $\frac{1}{2}(\vec{b}.\vec{d})-(\vec{a}.\vec{d})(\vec{b}.\vec{c})=1$    Book's Solution which i did not understand: $(\vec{a}\times\vec{b}).(\vec{c}\times\vec{d})=1$ is possible only when $|\vec{a}\times\vec{b}|=|\vec{c}\times\vec{d}|=0$ and $(\vec{a}\times\vec{b})$ is parallel to $(\vec{c}\times\vec{d})$ And the correct option given is $(C)$.  I could not solve this problem after some efforts.Please help me.Thanks. OED says:     doobie: a marijuana cigarette    Origin unknown. A relationship with dobby has been suggested.    dobby/dobbie: A silly old man, a dotard, a booby. Dialectal.      First citations:    1967   J. B. Williams Narcotics &amp; Hallucinogenics. Dubbe, Negro slang for a marijuana roach.    1982   A. Maupin Further Tales of City 95,  I smoke a doobie at lunch.   But I just chanced upon  in Yahoo Answers (don't laugh! :) where someone posted:     "It's obvious that Shaggy's a , I'm sure he's been feeding Scoob a bit of his hash and whatnot."    Scoob = , cartoon "pet" dog of constantly-hungry hippie/village idiot Shaggy (from 1969)   I'm not entirely convinced that 1967 dubbe was necessarily a significant factor in the appearance of  since around 1970 (the hippie era, some might say).  So I'd like to know whether it's credible to claim the usage arose (primarily?) through association with the TV show (specifically, the two characters therein closely associated with marijuana). Given a polynomial over a field, what are the methods to see it is irreducible? Only two comes to my mind now. First is Eisenstein criterion. Another is that if a polynomial is irreducible mod p then it is irreducible. Are there any others? What are the differences between a HashMap and a Hashtable in Java? What are the differences between a  and a  in Java?  Which is more efficient for non-threaded applications? How to get a UK visa refund I applied online for a visa application to the UK. I'm from Sri Lanka. Yesterday I cancelled the appointment, I changed my mind. I will not go to the visa appointment. Now my question is how I get my refund? Showing equality of sequence of holomorphic functions to limit function if converges uniformly locally I do not know how to proof following question:  Let $D$ be a domain in $C$.  ${{f}_{n}}$ be a sequence of holomorphic functions on $D$ that converges uniformly locally to a function non-constant $f$. Show that for each $z\in D$, there is a sequence ${{z}_{n}}\to z$ as ${{f}_{n}}({{z}_{n}})=f(z)$ for all sufficiently large $n$.  Actually, I know that I should use an assumption such as: ${{f}_{n}}({{z}_{n}})\ne f(z)$  Therefore, there is compact set    that  $\left\| {{f}_{{{n}_{k}}}}({{z}_{{{n}_{k}}}})-f(z) \right\|&gt;\varepsilon $  Then I think I have to use Montel theorem, but I do not know how to show the contradiction. Prove that if $X$ and it's closure $\overline X$ are connected and if $X\subset Y \subset \overline X$, show that Y is also connected. Can anyone give me a proof of the statement that if $X$ and its closure $\overline X$ are connected and if $X\subset Y \subset \overline X$, show that Y is also connected?  Thank you. Prime factorization of square numbers Let n be a natural number with unique prime factorization $p^m$... $q^k$ . Show that n can be written as a square if and only if  all (m, ...k) are even Multiple Inheritance in C# Since multiple inheritance is bad (it makes the source more complicated) C# does not provide such a pattern directly. But sometimes it would be helpful to have this ability. For instance I'm able to implement the missing multiple inheritance pattern using interfaces and three classes like that: public interface IFirst { void FirstMethod(); } public interface ISecond { void SecondMethod(); }  public class First:IFirst  {      public void FirstMethod() { Console.WriteLine(&quot;First&quot;); }  }  public class Second:ISecond  {      public void SecondMethod() { Console.WriteLine(&quot;Second&quot;); }  }  public class FirstAndSecond: IFirst, ISecond {     First first = new First();     Second second = new Second();     public void FirstMethod() { first.FirstMethod(); }     public void SecondMethod() { second.SecondMethod(); } }  Every time I add a method to one of the interfaces I need to change the class FirstAndSecond as well. Is there a way to inject multiple existing classes into one new class like it is possible in C++? Maybe there is a solution using some kind of code generation? Or it may look like this (imaginary c# syntax): public class FirstAndSecond: IFirst from First, ISecond from Second { }  So that there won't be a need to update the class FirstAndSecond when I modify one of the interfaces.  EDIT Maybe it would be better to consider a practical example: You have an existing class (e.g. a text based TCP client based on ITextTcpClient) which you do already use at different locations inside your project.  Now you feel the need to create a component of your class to be easy accessible for windows forms developers. As far as I know you currently have two ways to do this:  Write a new class that is inherited from components and implements the interface of the TextTcpClient class using an instance of the class itself as shown with FirstAndSecond.  Write a new class that inherits from TextTcpClient and somehow implements IComponent (haven't actually tried this yet).   In both cases you need to do work per method and not per class. Since you know that we will need all the methods of TextTcpClient and Component it would be the easiest solution to just combine those two into one class. To avoid conflicts this may be done by code generation where the result could be altered afterwards but typing this by hand is a pure pain in the ass.