Global variables cannot be accessed within a function without using the global keyword; (fine) but I did not expect the following:  Case 1:  a = 1  def f():   a += 1   print(a)  &gt;&gt;&gt; f() ... UnboundLocalError: local variable 'a' referenced before assignment   Reason I presume: Function could not find variable a in its local scope.  Case 2:  a = 1  def f():   print(a)  &gt;&gt;&gt; f() 1   But now, the function finds variable a in its local scope. Contradicts, the reason I presumed in the previous case.  Why is this happening?
The following code works as expected in both Python 2.5 and 3.0:  a, b, c = (1, 2, 3)  print(a, b, c)  def test():     print(a)     print(b)     print(c)    # (A)     #c+=1       # (B) test()   However, when I uncomment line (B), I get an UnboundLocalError: 'c' not assigned at line (A). The values of a and b are printed correctly. This has me completely baffled for two reasons:   Why is there a runtime error thrown at line (A) because of a later statement on line (B)? Why are variables a and b printed as expected, while c raises an error?   The only explanation I can come up with is that a local variable c is created by the assignment c+=1, which takes precedent over the "global" variable c even before the local variable is created. Of course, it doesn't make sense for a variable to "steal" scope before it exists.  Could someone please explain this behavior?
Example of a relation that is symmetric and transitive, but not reflexive Can you give an example of a relation that is symmetric and transitive, but not reflexive?   By definition,   $R$, a relation in a set $X$, is reflexive if and only if $\forall x\in X$, $x\,R\,x$.  $R$ is symmetric if and only if $\forall x, y\in X$,  $x\,R\,y\implies y\,R\,x$. $R$ is transitive if and only if $\forall x, y, z\in X$, $x\,R\,y\land y\,R\,z\implies x\,R\,z$.    I can give a relation $\leqslant$, in a set of real numbers, as an example of reflexive and transitive, but not symmetric. But I can't think of a relation that is symmetric and transitive, but not reflexive. Decode JWT Token in Apex I am trying decode JWT token in apex, and i am not sure how that can be done. If anyone has done that before, please let me know the process.  A JWT token is sent to SFDC and need to decode it in apex class.  Questions: 1) Can we decode the JWT using any standard salesforce classes, if yes what class and method? 2) Or do we need to decode it with our custom code -- if so can you provide an example. I want to color sketches in Photoshop, but when I prepared the sketch (using Levels, Hue, and other modifications) to turn it into workable line art, some details were missing. I think it depends on how you draw your sketch.  What are important steps for drawing a sketch (with pen or pencil) that is to be colored in Photoshop? A step-by-step instruction would be appreciated.  For instance, here it is the sketch    This is after my preparations in Photoshop Software to draw illustrative figures in papers I would like to have suggestions of good software for drawing illustrations in research papers. I already know about , but this works only on Linux and is at times, clunky when it comes to text. Moreover the resolution is not always perfect making it difficult to manoeuvre the objects. Besides it is tough to learn and master, with all its weird click procedures.   I would love to know about better alternatives. Not talking about graphs here, just block diagrams and explanatory illustrations. Why is my toilet bubbling? Last night while my washing machine and sink in the master bath was running, my master toilet started having air bubbles come up.  Then this morning while I was showering I heard bubbles again, and the shower was draining very slowly.  After the bubbles occurred my toilet in the master bath and powder room completely drained of water in the bowl and tank.  What is happening? When editor does not respond to the request for withdrawal I submitted a manuscript to a journal, but due to some issue with that I asked the Editor-in-Chief and Associate Editor to withdraw the manuscript from further consideration. Despite several emails, they are not still responding me nor ended the process.  Now, what should I do? Can I submit the manuscript to another journal? With a Canon 550D camera and a Tamron 18-270 mm zoom lens, I tried to fix shutter time, aperture (f/8.0 to cover all zoom range), and ISO, so the exposure meter read 0.0 with 18 mm focal length and while focusing on a uniform white wall.  Then I changed to 270 mm focal length, but the exposure reading did not change significantly (only to -0.7).  However, I had expected exposure to change, since only (18 mm / 270 mm) ** 2 = 1/225 of the wall is now covered in compare the coverage when focal length is 18 mm, thus only 1/225 of the light gets to the sensor after the change of focal length.  Why does exposure not change when narrowing the field of view with change of focal length? JSON Parsing in Android OS X El Capitan and older not available on App Store? So it turns out I can not install Sierra because I have a Mid2009 Macbook Pro. I wanted to update to El Capitan, but it turns out its no longer available on the app store?  Any ideas, how to get El Capitan? How does \fontsize{}{} work? With the package anyfontsize I can use the command \fontsize{}{}. But the second argument seems to be without any effect. I read  that it is related to the line space. It doesn't work.  \documentclass{article} \usepackage{anyfontsize} \begin{document}  {\fontsize{1cm}{1cm}\selectfont First test : I need to put some text here.}  \bigskip  {\fontsize{1cm}{2cm}\selectfont Second test : I need to put some text here --- does it work?}  \end{document}     Any clue? Query Which Profiles Have Read Access To Specific Object? Since I couldn't think of how to write this query off the top of my head, I thought it might be worth sharing. How can I query which Profiles have Read permission on a specific object? I knew it would have something to do with ObjectPermissions and PermissionSet, but had to look up the documentation for both to piece it together. I have the task of creating a simple Excel sheet that takes an unspecified number of rows in Column A like this:  1234 123461 123151 11321   And make them into a comma-separated list in another cell that the user can easily copy and paste into another program like so:  1234,123461,123151,11321   What is the easiest way to do this? MAC addresses in JavaScript I know that we can get the MAC address of a user via IE (ActiveX objects).  Is there a way to obtain a user's MAC address using JavaScript? Most statements regarding Riemann integrals (at least the ones that I have encountered) begin with the statement "for $f(x)$ bounded on $[a,b]$." I am wondering if Riemann integrability implies boundedness. I think that this has to be the case, but I am not sure. If Riemann integrability does imply boundedness, are improper integrals considered Riemann integrals? I would think that improper integrals wouldn't be Riemann integrals since improper integrals are allowed to be equal to $+\infty$ or $-\infty$. Or are improper integrals that are not equal to $\infty$ considered Riemann integrals?   I am confused. Where to find my Favorites in Google Chrome? Where can I find my Favorites in Google Chrome ?  Where to find the folder that contains them ? how to create shortcode in wordpress So I have the following code:   &lt;span class="delete"&gt;&lt;a onclick="return confirm('Are you sure?');" href="&lt;?php echo wp_nonce_url( add_query_arg( array( 'action' =&gt; 'my-delete-product', 'product_id' =&gt; $post-&gt;ID ), my_get_navigation_url('products') ), 'my-delete-product' ); ?&gt;"&gt;&lt;?php _e( '삭제', 'my' ); ?&gt;&lt;/a&gt; | &lt;/span&gt;   It is a simple button.  I want to make this into a shortcode so that I can use it anywhere where appropriate.  Any suggestions?  Thanks. I stumbled across this relationship while I was messing around. What's the proof, and how do I understand it intuitively? It doesn't really make sense to me that the sum of odd numbers up to $2x + 1$ should equal $x^2$. Is it possible to see own 'review queue audits' results? I completed recently a few review audits, some of them I passed, some I failed.  Is there a place I could (easily) find these results? How do I resize my current ubuntu partition? Square root of an inverse gamma distributed random variable I work on the grouped t copula and try to replicate part of the following paper: &quot;The t copula with Multiple Parameters of Degrees of Freedom: Bivariate Characteristics and Application to Risk Management&quot;, Luo &amp; Shevchenko (2010). My Question: I need the distribution of the following random variable: $$ Y = \sqrt{\frac\nu X} $$ where X is Chi square distributed with v degrees of freedom. I found out that the following random variabe Z is inverse gamma distributed with alpha = v/2 and beta = v/2, $$ Z = {\frac\nu X} $$ So, basically I am looking for the distribution of the square root of an inverse gamma distributed random variable. Do you have any ideas?