Class initialization

Costin Gament costin.gament at gmail.com
Sun Aug 8 16:57:38 CEST 2010


Apparently, the code I've given here does, in fact, work. Still, I am
encountering a similar problem in a much larger class (it is in a
separate module, if that is any help). Also, the variable I am having
trouble with is itself another class. I don't think it's appropriate
to paste so much code in here, so if anybody has some knowledge about
similar problems...

On Sun, Aug 8, 2010 at 5:49 PM, Steven D'Aprano
<steve at remove-this-cybersource.com.au> wrote:
> On Sun, 08 Aug 2010 17:14:08 +0300, Costin Gament wrote:
>
>> Thank you for your answer, but it seems I didn't make myself clear. Take
>> the code:
>> class foo:
>>   a = 0
>>   b = 0
>> c1 = foo()
>> c1.a = 5
>> c2 = foo()
>> print c2.a
>> 5
>
> Incorrect.
>
>>>> class foo:
> ...   a = 0
> ...   b = 0
> ...
>>>> c1 = foo()
>>>> c1.a = 5
>>>> c2 = foo()
>>>> print c2.a
> 0
>
>
>
> --
> Steven
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list