Have a list with numeric strings, like so:  numbers = ['1.2', '5.6', '1'];   Would like to convert first two list elements to float, and last element to int:  numbers = [1.2, 5.6, 1];   Is there any one liner/elegant way of doing?  currently I'm doing with:   numbers = [ float(x) for x in numbers ] numbers[-1] = int(numbers[-1])   or  functions = [float, float, int] results = [func(arg) for func, arg in zip(functions, numbers)]
In Python, how can I parse a numeric string like "545.2222" to its corresponding float value, 545.2222? Or parse the string "31" to an integer, 31?  I just want to know how to parse a float str to a float, and (separately) an int str to an int.
AMT stock option scenario Keyword for the outer class from an anonymous inner class In the following snippet:  public class a {     public void otherMethod(){}     public void doStuff(String str, InnerClass b){}     public void method(a){         doStuff("asd",             new InnerClass(){                 public void innerMethod(){                     otherMethod();                 }             }         );     } }   Is there a keyword to refer to the outer class from the inner class?  Basically what I want to do is outer.otherMethod(), or something of the like, but can't seem to find anything. How to run untrusted Ruby code inside a safe sandbox? Mock vs MagicMock I have a sheet in which I first apply a filter to a certain column to show "Unique records only". Now I have a column which contains, for e.g., values like:  Applepie Applesauce Crabapple Banana Mango   What I need is the count of all visible cells containing the word "Apple". Note that this should exclude the hidden (filtered out) cells. Now I have found out a formula:  `=SUMPRODUCT(SUBTOTAL(3,OFFSET(Sheet1!A:A,ROW(Sheet1!A:A)-MIN(ROW(Sheet1!A:A)),,1))*(Sheet1!A:A="&lt;Text to search&gt;"))`   However the problem with this one is this formula searches for the entire text. NOT just a part of it. How do I modify this formula to return count of cells containing "Apple" i.e. for this example it should return 3 as the result. Why are there no discrete zero sets of a polynomial in two complex variables? Why is the zero set in $\mathbb{C}\times\mathbb{C}$ of a polynomial $f(x,y)$ in two complex variables always non-discrete (no zero of $f$ is isolated)? We are using following code in .php script for generate .pdf file.  $result1 = exec("R CMD Sweave /var/www/html/r/r_latex_sweave.Rnw");  $result2 = exec("pdflatex /var/www/html/r/r_latex_sweave.tex");   but, we are getting this errors when we are executing .Rnw and .tex files.  ! I can't write on file `r_latex_sweave.log'. Please type another transcript file name:  ! Emergency stop !  ==> Fatal error occurred, no output PDF file produced!  Note: We have .tex and .Rnw folder in /var/www/html folder? Logistic regression with binary dependent and independent variables Difference between staticmethod and classmethod What is a good way to catch the Mysterious Stranger? When ever I hear the music to indicate the Mysterious Stranger has arrived, I can never find him. It is almost like he is not in the vault.  What is a good way to catch the Mysterious Stranger? Where does he usually show up? Is a string literal in c++ created in static memory and destroyed only when the program exits? Isometric  Left Inverse Adjoint Is it true that: $$T\text{ isometric}\iff T^*\text{ left inverse}$$ Obviously: $$\text{"}\Rightarrow\text{": }\langle x,\tilde{x}\rangle=\langle Tx,T\tilde{x}\rangle=\langle x,T^*T\tilde{x}\rangle$$ $$\text{"}\Leftarrow\text{": }\langle Tx,T\tilde{x}\rangle=\langle x,T^*T\tilde{x}\rangle=\langle x,\tilde{x}\rangle$$ My problem is that I'm not sure about if the adjoint is left inverse then the operator necessarily is bounded so that domain issues might come into play... I'm having trouble with a proof by induction What are reserved filenames for various platforms? Is it possible to run some code when an assembly is loaded, without doing anything specific in the loading code? What I am looking for is like a static constructor on a type.  Eg:  Assembly A does not know about Assembly B, but B does know about A. Assembly A needs to know certain things about B if B is loaded. When Assembly B is loaded by the runtime (referenced, or explicit), I want a piece of code (static method or attribute) to be executed that calls a method in Assembly A.  The root cause of this problem is unknown types being encountered when serializing a type in A that contains types from B not known at compile time as interfaces are used. Suppress Chrome 'Failed to load resource' messages in console Stern-Brocot tree where each node has two fathers While browsing Stack Overflow, I noticed that I lost a lot of reputation:        Is this serial downvoting? Will it be corrected by a rep-recalculation? How often are those done?    Here's a second instance: Enable fractional scaling for Ubuntu 18.04 How do I convert materials from Blender Internal to Cycles? I know this may be a tough or confusing question, but I have numerous existing materials I created and reuse for a project, which were all prepared for Blender Internal.  Now, I want to start the transition to Cycles, but I've hit a roadblock. How can I transition my materials without completely starting over? Or should I just forget it and start with fresh materials?