Lets say I have three lists.  a=[1,2,3,4,5,6,7,8,9,10] b=[1,2,3,4,5,6,7,8,9,10] c=[1,2,3,4,5,6,7,8,9,10]   I want to create all permutations with a,b, and c.  from itertools import permutations a=[1,2,3,4,5,6,7,8,9,10] b=[1,2,3,4,5,6,7,8,9,10] c=[1,2,3,4,5,6,7,8,9,10]  perm = permutations([a,b,c]) for i in list(perm):     print (i)   This gives   ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])   which is not what I'm looking for.  I'm looking for a solution  [1,1,1],[1,2,1],[1,3,1],[1,4,1].....   Is this possible
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) ...]
Present perfect for past action with present effect If I seem tired, can I say: "I haven't slept last night"? If not, why have I been told that we use present perfect for actions that have present effects? How do I switch back to python2 after Anaconda set python3 as the default? Recently, I installed  on my 15.04 and ended up with this!  :~$ python --version Python 3.5.1 :: Anaconda 2.5.0 (64-bit)  :~$ python2 --version Python 2.7.9  :~$ python3 --version Python 3.5.1 :: Anaconda 2.5.0 (64-bit)   During the last moments of installation, I did enter something as yes in hurry, and I suppose it had to do something with this. (Ok, my fault, I should have handled that carefully, but I need help now, not criticism).    AFAIK this is definitely going to break other programs. What do I do now?    What I think could work.  Can this be done using aliases?  alias python=python2   But I ain't sure. I have a hook_form_alter in a module, and it should be firing, but it appears it's not. I've cleared caches and rebuilt the registry. Is there someplace in the database or somewhere else where I can see if my hook is registed? FWIW here is my hook:  /**  * Implements hook_form_alter  */ function my_module_form_alter(&amp;$form, &amp;$form_state, $form_id) {   drupal_set_message($form_id); } I've just installed a new SSD replacing an HDD in my old (late 2008) iMac. When I switched it on all I got on screen was a question mark.   On the advice of my son I tried cmdR during switch on with no result.   I then tried alt which at least got me a cursor on the screen, but nothing else. Any suggestions? I've got everything backed up on an external Hard Drive, by the way. How to move windows that open up offscreen? I have a dual monitor setup, and I recently played around with the positioning settings, and some of my single window applications do the favour of preserving where they were last closed, and opening in the same position later. Unfortunately, that now places them out of the viewable area of my screens!  Is there some way to force a particular window into the viewable area? I saw this question: .  My situation is a little different though.   My target moves, and the shooter moves.  Also, the shooter's velocity is added to the bullets' velocities, i.e. bullets fired while sliding to the right will have a greater velocity toward the right.   What I'm trying to do is to get the enemy to be able to determine where they need to shoot in order to hit the player.  Using the linked SO solution, unless the player and enemy are stationary, the velocity difference will cause a miss.  How can I prevent that?      Here is the solution presented from the stack overflow answer.  It boils down to solving a quadratic equation of the form:  a * sqr(x) + b * x + c == 0   Note that by sqr I mean square, as opposed to square root. Use the following values:  a := sqr(target.velocityX) + sqr(target.velocityY) - sqr(projectile_speed) b := 2 * (target.velocityX * (target.startX - cannon.X)       + target.velocityY * (target.startY - cannon.Y)) c := sqr(target.startX - cannon.X) + sqr(target.startY - cannon.Y)   Now we can look at the discriminant to determine if we have a possible solution.  disc := sqr(b) - 4 * a * c   If the discriminant is less than 0, forget about hitting your target -- your projectile can never get there in time. Otherwise, look at two candidate solutions:  t1 := (-b + sqrt(disc)) / (2 * a) t2 := (-b - sqrt(disc)) / (2 * a)   Note that if disc == 0 then t1 and t2 are equal. A map is continuous if and only if for every set, the image of closure is contained in the closure of image As a part of self study, I am trying to prove the following statement:  Suppose $X$ and $Y$ are topological spaces and $f: X \rightarrow Y$ is a map. Then $f$ is continuous if and only if $f(\overline{A})\subseteq \overline{f(A)}$, where $\overline{A}$ denotes the closure of an arbitrary set $A$.   Assuming $f$ is continuous, the result is almost immediate. Perhaps I am missing something obvious, but I have not been able to make progress on the other direction. Could anyone give me a hint which might illuminate the problem for me? I am trying to plot the function 1/x^2 but the result is obviously wrong, here is how it looks like    here is the code  \begin{center}      \begin{tikzpicture}      \begin{axis}[      %xlabel=$x$,     %ylabel={$f(x) = x^2 - x +4$}   ]      \addplot[blue] {1/(x^2)};     \end{axis}     \end{tikzpicture} \end{center}   Any suggestions on how to fix this? I'm developing a Custom Post Type plugin, which works fine in dev. Now that I've moved it to production, I'm getting a 404 when I try to display the template for the CPT.   So, two questions:  1- Is there some mechanism to determine the path WP took to get through the hierarchy?  2- Why wouldn't it just give me the single or index page?  I've dumped $wp_query and a stacktrace at the end of the 404. Here's part of what I found:  [query] =&gt; Array     (         [page] =&gt;          [pagename] =&gt; refletters/proximity     )  [request] =&gt; SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND (wp_posts.ID = '0') AND wp_posts.post_type = 'page'  ORDER BY wp_posts.post_date DESC  [posts] =&gt; Array     (     )  [queried_object] =&gt;  [queried_object_id] =&gt; 0   And the stack trace:  2013-04-27 22:16:41 - 24.52.197.40 - TRACE - index.php - 404.php[39] -      wordpress/wp-content/themes/notoriousconsultant/404.php[39] - aaLog-&gt;logtrace     wordpress/wp-includes/template-loader.php[50] - include     wordpress/wp-blog-header.php[16] - require_once     wordpress/index.php[17] - require   Thanks for your help. What does “a couple” mean to you, and what does “a few” mean to you? What does “a couple” mean to you, and what does “a few” mean to you?  Is there a proper way to use these words?  It was striking to hear that “a couple” meant two (2) to someone.  My reaction was, “how/why do you make a short word longer by adding an extra syllable to just say ‘two?’”  I think Few: 2-3, Couple 4-6, Several 7+.  What are your thoughts? How can I generate a sin wave with power law noise? "He is king" vs "He is a king." I'm reading a book and encountering the phrase "insert name is king" a lot. I'm wondering, what's the difference between them? When and why should I use "He is king" instead of "He is a king"?   Examples:        Tommen is king now   Yet if neither one is king, still, how could it be Lord Renly?   And he is a king, and you’re just a spy   Everyone else is a king or prince these days      Same with other words:        They elected him president.   They called him a thief. Over the past few weeks, there have been a number of complaints about users making suggested edits en masse whose quality was at least questionable.  Let an example of a low-quality edit be the addition of the web-frameworks tag to dozens of questions about the PHP web framework Laravel. No one is ever going to use it in a search, but Laravel is a framework, right?  (If you disagree about this being a low-quality edit, please  bear with me anyway - my point here is that the system through which such conflicts could be settled is broken.)   Examples          This is a toxic situation guaranteed to create strife because -   The new user is happy to have found a way to participate and earn some rep; they may be genuinely feeling that they are improving the site. The reviewers greenlighting most of their suggestions confirms them in their belief.   The reviewers usually see only one edit - and it's easy to see how they might go, "meh, this isn't a terribly useful edit, but hey, maybe it helps someone, and it's a new user. No point discouraging them."   The veteran users who check out the editor see dozens of what they perceive as low-quality edits, usually ignoring anything else that should be fixed in the post. To the veterans, the new user is systematically looking for excuses to make their pointless edits, creating a giant mess in order to  gain some rep - a mess they have to clean up, while there are no consequences for the editor, who gets to keep their ill-gotten points. While a bad question or answer can be downvoted - usually leading to a change of behaviour eventually - the edit system looks like it's wide open for gaming.   So tensions are high, and when there's dialog it can be angry. I'm not saying either side is completely right. I'm completely prepared to believe that many of these edits are in good faith, etc. But it's a mess because it's frustrating people. As said, there are no consequences for bad-faith mass editing; apart from commenting on some random post, there is no way to communicate with an editor. The outcome of a moderator flag is very much uncertain.  The absence of a clear set of rules means there's plenty of room for heated arguments.    Something needs to change here.  Either   We need super clear rules on what makes a good tag edit Tag-only edits should be allowed only for 2k+ users, or they should not gain 2 reputation points for &lt;2k users The possible 1000 rep gain for suggested edits needs to be rate-limited (say, 200 per month) (this is my favourite!) The possible 1000 rep gain for suggested edits needs to be lowered, say to 500 or 250 Rollbacks of suggested edits should result in annulment of the 2 points gained (this is terrible) There should be a system to vote on edits (yes, that's been suggested before) There should be a defined and officially sanctioned pathway, and ruleset, for moderator flags cast about these users    ... or something else. But something needs to give. Is it "I" or "me" in "Keep Tom and I/me updated"? In this case what is correct?        Keep Tom and I updated.      or         Keep Tom and me updated.      I understand that me is an object pronoun. And therefore I feel the second option is correct.  Especially, because I would say "Keep him updated" and also "Keep me updated". Instead of "Keep he updated" or "Keep I updated". But something about saying "Keep him and me updated" feels wrong.  However I am not sure, because several people have told me that in this case I is the correct option because it is being used in conjunction with a name (Tom) and not a pronoun. Is that correct? What's the difference between eq, eql, equal and equalp, in Common Lisp? What's the difference between eq, eql, equal and equalp, in Common Lisp?  I understand that some of them check types, some of them check across types an all that, but which is which?  When is one better to use than the others? I understand that the mechanics and design of a lightsaber aren't that complicated.  Do others besides the Jedi and Sith (or their minions) make or use lightsabers?  And if they don't, why not? What is CUPS server and how to share a printer (Locally or over a network) The title tells you all, except that it's about sharing printers.   How do I connect to a shared printer on the network through CUPS or terminal? Re-number a list when a new entry is inserted problems installing mathtools Scenario: My friend John has a personality disorder, intensely paranoid for example.  Can I say:     There were three events last year that told me John had a problem.   or can I say:     There were threee events last year that told me John has a problem.