On 12/04, LJ wrote:
> Hi All,
>
> I have a quick question regarding the modification of global variables within
> functions. To illustrate, consider the following toy example:
>
> a={"1": set()}
> b=9
>
> def gt(l):
>a["1"] = a["1"] | set([l])
>
> When calling this last function and checking t
LJ wrote:
> Hi All,
>
> I have a quick question regarding the modification of global variables
> within functions. To illustrate, consider the following toy example:
>
> a={"1": set()}
> b=9
>
> def gt(l):
>a["1"] = a["1"] | set([l])
The difference between this example and your second one:
On Fri, Dec 5, 2014 at 10:54 AM, Dave Angel wrote:
> Python doesn't have declarations, so when a function is compiled, the
> compiler has to infer what names are to be local and what are not. The rule
> it normally uses is roughly based on whether an assignment occurs somewhere
> inside the funct
On 12/04/2014 03:09 PM, LJ wrote:
Hi All,
I have a quick question regarding the modification of global variables within
functions. To illustrate, consider the following toy example:
a={"1": set()}
b=9
def gt(l):
a["1"] = a["1"] | set([l])
When calling this last function and checking the
On Thu, Dec 4, 2014 at 1:09 PM, LJ wrote:
>
> Hi All,
>
> I have a quick question regarding the modification of global variables
within functions. To illustrate, consider the following toy example:
>
> a={"1": set()}
> b=9
>
> def gt(l):
>a["1"] = a["1"] | set([l])
>
> When calling this last f
On Fri, Dec 5, 2014 at 7:09 AM, LJ wrote:
> def gt(l):
>a["1"] = a["1"] | set([l])
>
>
> def gt2(l):
>b=b+l
These two may both look like they're assigning something, but one of
them is assigning directly to the name "b", while the other assigns to
a subscripted element of "a". In the firs