Python return value
<p>I have a global variable <code>global_a</code> and the function to determine the value</p>

<pre><code># long Syntax
def assignement_a():
  global_a = len(xyz)
  return global_a
</code></pre>

<p>The point is to return the value to caller and simultaneously assign the value to the global to saved for further use, so I need something like this</p>

<pre><code># shorter syntax
def assignement_a():
  return global_a = len(xyz)
</code></pre>

<p>Is there a short syntax solution in python?</p>

<p>You can change the global variable from the caller function or statement for ex:</p>

<pre><code>global_a=0
var1=0
xyz="stackoverflow"
def assignement_a():
  return len(xyz)


def test():  
 global global_a
 global var1
 var1=global_a=assignement_a()
 print(var1)

test()
print(var1)
print(global_a)
</code></pre>

<p>Like test method is a caller and thus return value is assigned to global variable or it can be use for further process.</p>

python function return-value