On 2014-03-10, Marko Rauhamaa wrote:
> "Brunick, Gerard:(Constellation)" :
>
>> class Test(object):
>> x = 10
>>
>> def __init__(self):
>> self.y = x
>>
>> t = Test()
>> ---
>>
>> raises
>>
>> NameError: global name 'x' is not defined.
>
> In the snippet, x is neither local to __in
On Mon, Mar 10, 2014 at 11:27 AM, Brunick, Gerard:(Constellation)
wrote:
> The following code:
>
> ---
> class Test(object):
> x = 10
>
> def __init__(self):
> self.y = x
>
> t = Test()
> ---
>
> raises
>
> NameError: global name 'x' is not defined.
>
> in Python 2.7. I don't unde
"Brunick, Gerard:(Constellation)" :
> class Test(object):
> x = 10
>
> def __init__(self):
> self.y = x
>
> t = Test()
> ---
>
> raises
>
> NameError: global name 'x' is not defined.
In the snippet, x is neither local to __init__() nor global to the
module. It is in the class scop