ABELARDO <dio...@gmail.com> added the comment:

Sorry, I don't have any doc where "class value" / "instance value" are 
mentioned. This idea is original from me originally based on my personal 
interpretation about OOP basic concepts. But it doesn't mean I'm wrong with my 
proposal. 

When you use the following notation:
"foo.a" you are accessing to the value of that attribute. In Python, you would 
write: print(foo.a) to print the value of that attribute, being 'foo' an 
instance of the Foo class. Right.

All attributes are inheriting from a class; so, any attribute inside an 
instance is a "class attribute" but here I am not discussing this but the value 
itself.

This confusion could be caused because Python could implement a mechanism 
different than other OOP programming languages and I'm not sure if Python 
strictly follows this paradigm. 

I am a newbie in Python but not in OOP paradigm, where my discussion is 
focused. 

If Python doesn't strictly follow the OOP paradigm, you could gently delete 
this issue because we wouldn't talk about the same concept.

Otherwise, let's explain why I think the concept "class attribute" is wrong 
from my viewpoint.

IMHO, a "class attribute" doesn't exist in OOP as is. Really, a "class value" 
exists instead. A "class value" is a value (pay attention, please: not an 
attribute) shared among all instances from a class. You can do this by tagging 
an attribute as "static" (in Java and PHP, for example). The value of that 
attribute is, again, shared among all instances of that class. 

Nevertheless, when you don't declare an attribute with the tag "static" you are 
requiring the value (!) is not being shared among their instances.

It's not applied to attributes but values.

The attribute always is a class level property (all instances share this 
property still when the instances don't contain the same value for it).

Disclaimer: I'm not an English native. I made all my best to decently express 
in English but since it is not my native language I could have made typos which 
could twist my words.

Best regards.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41166>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to