Python class and variable issue(newby question!)

Steven D'Aprano steve+comp.lang.python at
Fri Mar 29 23:51:15 CET 2013

On Sat, 30 Mar 2013 08:24:00 +1100, Chris Angelico wrote:

> On Sat, Mar 30, 2013 at 8:12 AM, Sam Berry <sambez_14 at>
> wrote:
>> class test()
>>     s = 1
>>     def test1()
>>         global s
>>         s = 2

> That's not a global, that's a class variable.

/me thwacks Chris with a halibut.

Not only is "class variable" ambiguous, but Python uses different scoping 
rules for "variables" (name bindings) and attributes.

I don't know what language first decided to conflate object attributes 
and variables -- I suspect Java -- but it is actively harmful terminology 
(in Python at least, if not in general) and whoever invented it is bad 
and should feel bad.


More information about the Python-list mailing list