**def colour_generator(lst):     for i in lst:         yield i  print()  colours=['red','green','blue']  print(colour_generator(colours))**   here the funtion colour_generetor returns the object address but if in the same code we replace 'yield' with 'return' then it  returns the first element in the list(lst).. Is 'yield' completely different from 'return' statement ?  Moreover **is it really possible to create object of a function?**As the output when 'return' statement is used instead of 'yield' statement in the above code is :"" or it is something else ?
What is the use of the yield keyword in Python? What does it do? For example, I'm trying to understand this code1: def _get_child_candidates(self, distance, min_dist, max_dist):     if self._leftchild and distance - max_dist &lt; self._median:         yield self._leftchild     if self._rightchild and distance + max_dist &gt;= self._median:         yield self._rightchild    And this is the caller: result, candidates = [], [self] while candidates:     node = candidates.pop()     distance = node._get_dist(obj)     if distance &lt;= max_dist and distance &gt;= min_dist:         result.extend(node._values)     candidates.extend(node._get_child_candidates(distance, min_dist, max_dist)) return result  What happens when the method _get_child_candidates is called? Is a list returned? A single element? Is it called again? When will subsequent calls stop?   1. This piece of code was written by Jochen Schulz (jrschulz), who made a great Python library for metric spaces. This is the link to the complete source: [Module mspace][1].
What happens when many neurons have same weights? Does it make any sense to have two (or more) neurons in a neural network with the same weights? (intuitively it makes no sense, since all the neurons would behave the same way).   Please consider both the input and hidden layers. What if the weights are equal 0? How do I calculate the date six months from the current date using the datetime Python module? Creating "Inner Buffer" using ArcGIS for Desktop? I am currently searching for how to create an "Inner Buffer" in ArcGIS for Desktop?  I have a lot of polygons (houses) in one feature class, and one big polygon (in another feature class).   I want so select all houses contained in that one big polygon within a distance to the outer border (e.g. 1000 meters).  Select Layer By Location could be one possibility to solve this but I can't figure out how. How do you cast a List of supertypes to a List of subtypes? I've watched the Vampire Knight anime. I really like the story so far but find it frustrating that the anime doesn't finish off the story. I'm trying to figure out if it is worth reading the manga.  Does the manga contain more story than the anime? Does it finish the story off? bashrc lazy substitution Looking for a quick and dirty way to automate . I presume this could be done with an automation to press the mouse button from two separate pixel coordinates, with delay, so long as the browser window doesn't move -- unless there's a better way.  I tried building a Watch Me Do workflow, in Automator, but can't seem to get it to work.  I get the error "application Chrome is not running when it is expected to." It also never lists mouse clicks for some reason.  I do have accessibility set up, in system preferences > security &amp; privacy > privacy > accessibility.  Automator, Chrome and System Events are all checked within there (among other stuff of course).  I tried the markashworth workaround as detailed  -- which also doesn't seem to work. Using his method, I get this error:    UPDATE: I just downloaded "cliclick" and figured out how do both clicks as a terminal command, with the proper delays.  BUT -- I don't know code and need a way for this terminal command to repeat "x" amount of times.  Anyone know how I could do that in Script Editor?  The command line is:  cliclick c:132,286 w:100 c:132,286 w:5000 c:1100,238   I would need a few seconds of delay before the loop repeats, which I presume I could do with a final "w:" in that line.  Thanks for the help!! Convergence of $1-\frac12-\frac13+\frac14+\frac15+\frac16-....$ Animagi (Sirus specifically) and wands? I have 3 questions about animagus transformation and wands      Does animagus transformation require the use of a wand?   If yes, where does the wand go after the wizard transforms?   Again, if 1 is yes, how did Sirius transform into a dog in Azkaban?     Note that 2 and 3 are invalidated if the answer to 1 is no. If so, is it mentioned anywhere in the books, or can be implied by something in the books, that wand use is not required? I don't think Sirius managing to do it in Azkaban can be used as a proof here, as in Book 3 Wormtail needs a wand to change back into a rat How is it possible to use the GNU find command to match several file types at a time (one search command)?  The man page says:  -type c     File is of type c:     b      block (buffered) special     c      character (unbuffered) special     d      directory     p      named pipe (FIFO)     f      regular file     l      symbolic link; this is never true if the -L option or the -follow            option  is in  effect,  unless  the  symbolic link is broken.  If            you want to search for symbolic links when -L is in effect, use            -xtype.     s      socket     D      door (Solaris)   and I want to search for files (f) and symbolic links (l) and pipe it to another process. How can I search for both at the same time?  I have tried  find -type fl | … find -type f -type l | … find -xtype f -type l | …   I know a workaround would be to use a subshell  (find -type f; find -type l) | …   but I just want to know if it is possible. I've used git clone to make a local copy of a GitHub repository containing a  I'd like to use. The local copy contains all of the source for the program; but as a newbie to Ubuntu, I've no idea of what tools or steps are involved in compiling and installing the driver.   I'd really appreciate if anyone could provide a step-by-step guide? Why do I have so many .Xauthority.* files in my home directory? How to prove $B-A \succeq 0 \Leftrightarrow$ ellipsoid $x^TBx \leq 1$ contains $x^TAx \leq 1$? Assume $A \in \textbf{S}^n_{++}$, an ellipsoid centered at the origin given by $$\mathcal{E}_A = \{x\mid x^TA^{-1}x \leq 1\}$$ Then we have $\mathcal{E}_A \subseteq \mathcal{E}_B $ if and only if $B-A \succeq 0$. This is the proposition in the Boyd &amp; Vandenberghe's  (pages 45-46). The authors gave only the result, without proof. How to prove it? When I launch nautilus from terminal the following error is printed and nautilus doesn't open up.  (nautilus:25179): GLib-GIO-CRITICAL **: g_dbus_interface_skeleton_unexport: assertion 'interface_-&gt;priv-&gt;connections != NULL' failed  (nautilus:25179): GLib-GIO-CRITICAL **: g_dbus_interface_skeleton_unexport: assertion 'interface_-&gt;priv-&gt;connections != NULL' failed Could not register the application: Timeout was reached  (nautilus:25179): Gtk-CRITICAL **: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed  (nautilus:25179): GLib-GObject-WARNING **: invalid (NULL) pointer instance  (nautilus:25179): GLib-GObject-CRITICAL **: g_signal_connect_object: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed   What could be the problem?? I'm trying to prove the problem below - which comes from Munkres' "Analysis on Manifolds" book in the section on the Inverse function theorem.  Since its in the chapter on the Inverse Function Theorem I figured I'd start by showing that $f$ satisfies the conditions of the theorem.  Writing the Jacobian shows that it's both $C^r$ and we get $\det f'(x,y)=4x^2+4y^2\neq0$ when $x&gt;0$.  So we can apply the theorem but I'm unsure of how to proceed to show that $f$ is $1$-$1$.  And I didn't see how to use the hint they provided.  Thanks!      Let $f\colon \mathbf R^2\to \mathbf R^2$ be defined by the equation   $$f(x,y)=(x^2-y^2,2xy).$$   (a) Show that $f$ is one-to-one on the set of all $(x,y)$ with $x&gt;0$. [Hint: If $f(x,y)=f(a,b)$, then $\|f(x,y)\|=\|f(a,b)\|$.] Where can I find a complete reference for the $PS1 variable? The default PS1 variable on my machine (Kubuntu 13.10) is this:  \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$   I'm looking for a reference for how the $PS1 variable works that, at a minimum, allows me to understand the above PS1 variable. How to get rights of admin after I disabled all admin accounts in my computer Limiting range of value types in C++ Suppose I have a LimitedValue class which holds a value, and is parameterized on int types 'min' and 'max'.  You'd use it as a container for holding values which can only be in a certain range.  You could use it such:  LimitedValue&lt; float, 0, 360 &gt; someAngle( 45.0 ); someTrigFunction( someAngle );   so that 'someTrigFunction' knows that it is guaranteed to be supplied a valid input (The constructor would throw an exception if the parameter is invalid).  Copy-construction and assignment are limited to exactly equal types, though.  I'd like to be able to do:  LimitedValue&lt; float, 0, 90 &gt; smallAngle( 45.0 ); LimitedValue&lt; float, 0, 360 &gt; anyAngle( smallAngle );   and have that operation checked at compile-time, so this next example gives an error:  LimitedValue&lt; float, -90, 0 &gt; negativeAngle( -45.0 ); LimitedValue&lt; float, 0, 360 &gt; postiveAngle( negativeAngle ); // ERROR!   Is this possible?  Is there some practical way of doing this, or any examples out there which approach this? Duplicate objects transformation applies to both objects I'm facing this frustrating "feature" that I can't seem to remedy; when I duplicate an object (and now, even when I create two completely new objects), their transformations/scaling is synchronized. This is extremely annoying when trying to use any sort of transformation keyboard shortcut.  It should be noted by going to the properties menu (N) and manually setting the properties works just fine.  For instance, here is just the camera selected (trust me, I made sure):   And when I try to transform by clicking+dragging on the X axis OR by hitting G->X, this happens:   They are not grouped (verified by going to the Groups list up in the Scene panel) and they do not have parents (verified by going to Object->Relations).  I have tried the unlink command as well, to no avail.  I have seriously run out of options; what did I change to have my G->X shortcuts transform multiple objects? It seems completely at random, too; certain objects seemed to be "linked" to other random objects, and this "linking" is guaranteed when duplicating even when I do a non-linking duplicate (Shift+D).  What gives? What is the name of the operation $v^T H v$? To find out how something is called is the one thing I don't know how to use Google for.  If I have a vector $v$ and a symmetric matrix $H$, then the operation $v^T H v$ gives me some sort of projection of the matrix $H$ on the vector $v$. For example if $H$ is the Hessian, the operation gives me the second derivative in the direction of $v$.  What is the name of this operation?