Suppose I have a relatively long module, but need an external module or method only once.  Is it considered OK to import that method or module in the middle of the module?  Or should imports only be in the first part of the module.  Example:  import string, pythis, pythat ... ... ... ... def func():      blah      blah       blah      from pysomething import foo      foo()      etc      etc       etc ... ... ...   Please justify your answer and add links to s or relevant sources
states:  Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.  However if the class/method/function that I am importing is only used in rare cases, surely it is more efficient to do the import when it is needed? Isn't this: class SomeClass(object):      def not_often_called(self)         from datetime import datetime         self.datetime = datetime.now()  more efficient than this? from datetime import datetime  class SomeClass(object):      def not_often_called(self)         self.datetime = datetime.now()
How to read a line from the console in C? What is the simplest way to read a full line in a C console program The text entered might have a variable length and we can't make any assumption about its content. Why is it not true that if $\Phi \models \exists x \phi$ then there is a term $t$ with $\Phi \models \phi \frac{t}{x}$? Use the triangle inequality to show that $|a|+|b| \leq |a+b|+|a-b|$ How would I go about proving that  $$|a|+|b| \leq |a+b|+|a-b|$$  Using the triangle inequality?  I tried squaring both sides, yielding:  $$|a|^2 +|b|^2 +2|a||b| \leq 2|a|^2+2|b|^2+2||a|^2-|b|^2|$$  Is it correct to move the terms to the other side? I tried $$2|a||b| \leq |a|^2+|b|^2+2||a|^2-|b|^2|$$ Then it is obvious that  $$0\leq |a|^2+|b|^2-2|a||b| +2||a|^2-|b|^2|$$ $$0\leq (|a|-|b|)^2 +2||a|^2-|b|^2|$$ $$0\leq ||a|-|b||^2 +2||a|^2-|b|^2|$$  But I have neither used the triangle inequality, nor it looks mathematically rigorous for my real analysis class. Any tips and tricks for solving these problems? "There are no comments" vs. "There is no comment" Let a,b,c be positive real number, such that  $\frac{1}{a}+\frac{1}{b}+\frac{1}{c}=a+b+c$. Prove that :  $\frac{1}{(2a+b+c)^2}+\frac{1}{(2b+c+a)^2}+\frac{1}{(2c+a+b)^2} \leq \frac{3}{16}$  Can anyone help me how to deal with it? Novel about interstellar war: Both sides win, both sides think they lost I recall reading this novel in the &rsquo;90s; my recollection is that the author was better-known for bad fantasy than for SF (but the SF of his that I&rsquo;d read was better than his fantasy).  The story opened in media res just before a battle was joined; there is a dialogue between the captain of one of the ships and one of his crew. We never see the actual battle; we instead see the conquest of Earth by the aliens - and the conquest of the alien homeworld by Earth.  It is slowly revealed that the two sides contrived a way to both avoid the destruction of actual war, and solve their respective worlds&rsquo; respective problems of overpopulation, infrastructure decay, et multae ceterae. We also see that the solution was that the conquering aliens were secretly selecting Earthmen to rule their homeworld, while the humans were selecting aliens to rule Earth.  About halfway through, there is suddenly a third world that must be &lsquo;conquered&rsquo; and brought into the network. The plot gets complicated after that. Why is it true that $\mathrm{adj}(A)A = \det(A) \cdot I$? Suspend broken on Ubuntu 16.04 LTS, Dell XPS 9350 Since I upgraded from Ubuntu 15.10 to Ubuntu 16.04 LTS on my Dell XPS 9350, suspend is broken. When closing my lid the laptop will suspend, but resuming fails and it reboots. I tried pm-suspend and tried resuming, resuming failed and the laptop rebooted. I got the following errors when I got back into Ubuntu. The odd thing in my opinion is that it claims the kernel is not an official ubuntu package. Either way my Linux knowledge is not sufficient to know what's going wrong here.      EDIT: I just tried installing kernel 4.4.8 which should fix some things, but it did not fix this problem. By now I also tried 4.4.9 and 4.6 RC7. None of them fixed it for me. How do you debug PHP scripts? How do you debug PHP scripts?  I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in PHPEclipse is also quite useful.  What is the best (in terms of fast and easy) way to debug in phpStorm or any other IDE? Why am I constantly running out of space on my Galaxy S2? Putting a matrix inside of caption gives \caption has an extra } I have looked for similar questions here on stack exchange. The closest example to this that I found is . That question assumed less than perfect absorption of material lining the inside of the sphere, and the effect of thermally re-radiating it inside the sphere.  A lot of the answers focused on that much of the thermal radiation would not be reflected back to the star, and is likely to be reabsorbed by the sphere at another location. On the other hand, this question asks what would happen if the Dyson sphere, using mirrors, deliberately refocus a significant portion of the rays directly back at the star. Prove inequality using Schwarz's Lemma I'm having trouble proving the following:  Let $f$ be analytic on $D(0,R)$ and suppose there is a real constant A for which $\operatorname{Re}f(z) &lt; A$ for all $z \in D(0,R)$. If $f(0) = 0$, show that $|f(z)| \leq \frac{2A|z|}{R-|z|}$.   I was told to first start by showing that $|\frac{f(z)}{2A-f(z)}| \leq 1$ and also use the following result, which I was able to prove:  Let $f$ be analytic on $D(0,R)$ and let $f(0)=0$. If $|f(z)| \leq M$ for all $z \in D(0,R)$, then $|f(z)| \leq M|z|/R$ for all $z\in D(0,R)$.  Thanks in advance! SSL certificate for a public IP address? I just tried buying a Comodo Positive SSL but it was rejected due to not supporting a public IP address, but instead they only support a domain name.  Does anyone know any SSL certificate provider that supports public IP address instead of a domain name?  My company has a dedicated server hosted with a web hosting company, which is used for running a bugtracker for multiple projects (for multiple clients). Since it's only used for a bugtracker, we don't need a domain name (our clients access it by typing the public IP in their browser). Windows 8 removes Grub as default boot manager Combining two expressions (Expression>) I have two expressions of type Expression&lt;Func&lt;T, bool&gt;&gt; and I want to take to OR, AND or NOT of these and get a new expression of the same type  Expression&lt;Func&lt;T, bool&gt;&gt; expr1; Expression&lt;Func&lt;T, bool&gt;&gt; expr2;  ...  //how to do this (the code below will obviously not work) Expression&lt;Func&lt;T, bool&gt;&gt; andExpression = expr AND expr2 I'm having a really, really hard time figuring out how to install mods on Minecraft. I've looked everywhere I can think of for help but the information is almost always outdated or unhelpful.  I've seen on several sites about the use of something called Forge. The Mod I want to use requires 1.6.4 Forge and I have both Forge and the Mod folders sitting in my downloads folder.  I haven't installed any kind of mods for any game prior to this and I have little clue to the technical side of Minecraft, so please keep this in mind when you give me an answer please!  Things that might help you figure out how to help me:   I want to play this mod  and am using the 1.6.4 Forge given on a link that website gives I installed Windows 7 in a 3-year-old machine. It installed successfully, took all drivers and running great, but every 5-6 minutes it freezes for a few seconds... 30 seconds to 1 minute, and then it comes back alive.  I checked Event Viewer, but nothing matched the frozen timeline.  I would appreciate any help on how to detect what is causing it, service or hardware.  After it comes alive, everything runs normal. I did run Task Manager and checked CPU usage, at the time it freezes just before and after that no task took more CPU or memory. It was like an idle machine.  There aren't any external USB drives or devices. It is an on-board Intel desktop board with SATA HDD, and the SATA HDD is running in absolute good mode. Why do I get the error "failed unmounting /var" during shutdown? I have a fresh install of Debian 9.0.0. It has a separate 1 GB partition for /var formatted at ext4. When I shutdown from the terminal, using shutdown -h now, there is a bright-red error message stating "failed unmounting /var".  What is the fix for this error? Bolzano-Weierstrass Theorem Proof Abbott (Ax. of Choice) In Abbott's Proof of the Bolzano-Weierstrass Theorem, does Abbott use any form of the Axiom of Choice ?   I think he is since he chooses an $a_{n_k} \in I_k$ where there are multiple such $a_{n_k}$.