Class Variable Access and Assignment

Antoon Pardon apardon at forel.vub.ac.be
Fri Nov 4 02:31:46 EST 2005


Op 2005-11-03, Stefan Arentz schreef <stefan.arentz at gmail.com>:
> Antoon Pardon <apardon at forel.vub.ac.be> writes:
>
>> Op 2005-11-03, Stefan Arentz schreef <stefan.arentz at gmail.com>:
>> > Antoon Pardon <apardon at forel.vub.ac.be> writes:
>> >
>> > ...
>> >
>> >> Fine, we have the code:
>> >> 
>> >>   b.a += 2
>> >> 
>> >> We found the class variable, because there is no instance variable,
>> >> then why is the class variable not incremented by two now?
>> >
>> > Because it really is executed as:
>> >
>> >  b.a = b.a + 2
>> 
>> That is an explanation, not a reason. 
>
> I'm just following the 
>
>> >   1. get 't'b.a and store it in a temporary 't' (found the instance)
>> >   2. add 2 to 't'
>> >   3. store 't' in 'b.a'
>> >
>> > The last operation stores it into an instance variable.
>> 
>> [ I think you mean '(found the class variable)' in line 1 ]
>> 
>> All you are doing here is explain how the current implemantation treats
>> this. You are not giving arguments for why the result of this
>> implementation should be considered sane behaviour.
>
> Ah yes. Well, good luck with that. You seem to have decided that it is not
> sane and who am I to argue with that. It depends on your state of mind :-)

I can just say the opposite, that you seem to have decided that it is
sane.

> The model makes sense in my opinion. If you don't like it then there are
> plenty of other languages to choose from that have decided to implement
> things differently.

And again this argument. Like it or leave it, as if one can't in general
like the language, without being blind for a number of shortcomings.

It is this kind of recations that make me think a number of people is
blindly devoted to the language to the point that any criticism of
the language becomes intollerable.

-- 
Antoon Pardon



More information about the Python-list mailing list