Variables vs attributes

Piet van Oostrum piet at cs.uu.nl
Sat Apr 18 16:13:02 EDT 2009


>>>>> Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> (SD) wrote:

>SD> On Fri, 17 Apr 2009 17:48:55 +0200, Diez B. Roggisch wrote:
>>> No, because you are creating *classvariables* when declaring things like
>>> this:
>SD> ...
>>> OTOH, when assigning to an instance, this will create an
>>> *instance*-variable. Which is what


>SD> If an integer variable is an integer, and a string variable is a string, 
>SD> and float variable is a float, and a list variable is a list (there's a 
>SD> pattern here), shouldn't a class variable be a class and an instance 
>SD> variable be an instance?

If a wooden bench is made of wood, what is a garden bench made of?

>SD> I had never noticed the usage of "variable" to mean attribute until a few 
>SD> months ago. What's going on? Why did people decide that confusing 
>SD> variables and attributes of variables was a good thing? What's next, 
>SD> describing dictionary keys as "dictionary variables"?

If you google for '"instance variable" python' you get quite a number of
hits, not only recent ones. Albeit two orders of magnitude fewer than
for 'attribute python'.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list