On 04/04/2014 19:55, Ian Kelly wrote:
On Fri, Apr 4, 2014 at 12:37 PM, Rotwang wrote:
Hi all. I thought I had a pretty good grasp of Python's scoping rules, but
today I noticed something that I don't understand. Can anyone explain to me
why this happens?
x = 'global'
def f1():
x = 'loca
On Fri, Apr 4, 2014 at 12:37 PM, Rotwang wrote:
> Hi all. I thought I had a pretty good grasp of Python's scoping rules, but
> today I noticed something that I don't understand. Can anyone explain to me
> why this happens?
>
x = 'global'
def f1():
> x = 'local'
> class C:
>
Hi all. I thought I had a pretty good grasp of Python's scoping rules,
but today I noticed something that I don't understand. Can anyone
explain to me why this happens?
>>> x = 'global'
>>> def f1():
x = 'local'
class C:
y = x
return C.y
>>> def f2():
x = 'local'
cl