Thank you all. I understood the global function now.
On Wed, Feb 26, 2014 at 7:42 PM, eryksun wrote:
> On Wed, Feb 26, 2014 at 8:45 AM, Steven D'Aprano
> wrote:
> >> :4: SyntaxWarning: name 'a' is assigned to before global
> declaration
> >
> > This is just a warning. It is STRONGLY RECOMMENDE
On Wed, Feb 26, 2014 at 8:45 AM, Steven D'Aprano wrote:
>> :4: SyntaxWarning: name 'a' is assigned to before global declaration
>
> This is just a warning. It is STRONGLY RECOMMENDED that you put the
> global declaration at the top of the function, but it is not compulsary.
> If you put it somewhe
On Wed, Feb 26, 2014 at 12:42:00PM +0530, Santosh Kumar wrote:
> All,
>
> Requirement : i want to call a variable assigned outside a function scope
> anytime within the function. I read "global" is a way.
You can *read* the value of a global from inside a function without
needing to declare it a
On 26/02/14 07:12, Santosh Kumar wrote:
All,
Requirement : i want to call a variable assigned outside a function
scope anytime within the function.
call in Python means something very specific, namey that you put parens
after the name and that hopefully results in some code being executed.
Y
Santosh Kumar Wrote in message:
>
Requirement : i want to call a variable assigned outside a function scope
anytime
> within the function. I read "global" is a way.
>
Your sample code doesn't do any calling. But if your design
requires you to assign to a global from inside a function, t
All,
Requirement : i want to call a variable assigned outside a function scope
anytime within the function. I read "global" is a way.
a) Case I looks fine.
b) Case II is bombing out.
Is this how it works or please correct me if i am wrong.
case I:
In [17]: a = 10
In [19]: def fun_local():