[issue41166] CLASS ATTRIBUTES
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
New submission from ABELARDO <diox76@gmail.com>: Hi there, I have encountered a possible bug inside the documentation. In the attached picture you can see a portion of text highlighted ("Class attribute"). I think it's a typo since there is not "class attributes" nor "instance attributes" but "class value" and "instance value". A "class value" is a value which is shared among instances and an "instance value" is a specific value of an attribute of an instance. Best regards. ---------- assignee: docs@python components: Documentation files: Captura de pantalla de 2020-06-30 08-50-39.png messages: 372660 nosy: ABELARDOLG, docs@python priority: normal severity: normal status: open title: CLASS ATTRIBUTES versions: Python 3.8 Added file: https://bugs.python.org/file49278/Captura de pantalla de 2020-06-30 08-50-39.png _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41166> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Dennis Sweeney <sweeney.dennis650@gmail.com> added the comment: I think the word "attribute" is preferred over "value" because "value" can mean just about anything, whereas, according to https://docs.python.org/3/glossary.html?highlight=glossary , an attribute is specifically: """A value associated with an object which is referenced by name using dotted expressions. For example, if an object `o` has an attribute `a` it would be referenced as `o.a`.""" The phrase "class attribute" is used throughout the documentation to mean an attribute of a class. To reference the class attribute called `foo` of the class called `MyClass`, we write `MyClass.foo`. Unless I misunderstand you, I don't think there is an issue. ---------- nosy: +Dennis Sweeney _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41166> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Steven D'Aprano <steve+python@pearwood.info> added the comment: "Class attribute" and "instance attribute" are the usual terms used in the Python documentation and community. I have heard other terms used in other language communities, in particular "members" and "variables", but I've never come across one that uses "value". Do you mind if you tell us where you have seen this used? We have 30 years of talking about class and instance attributes, we're not going to change now. Java has ClassValue: https://docs.oracle.com/javase/7/docs/api/java/lang/ClassValue.html and Scala talks about "value classes", but neither seem to be what you are talking about. See also: https://stackoverflow.com/questions/11350423/terminology-of-class-attribute-... ---------- nosy: +steven.daprano resolution: -> rejected stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41166> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Steven D'Aprano <steve+python@pearwood.info> added the comment: By the way, for future reports, it is much better to give the URL of the page and copy and paste the exact quote than to give a screen shot. Using a screen shot is inconvenient for us (we have to try to guess what URL you are referring to, there are *lots* of pages in the documentation) and discriminates against the visually impaired and blind, who may be using screen readers. (They typically do not work with images.) Thank you. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41166> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
ABELARDO <diox76@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 <report@bugs.python.org> <https://bugs.python.org/issue41166> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
ABELARDO <diox76@gmail.com> added the comment: Steven D'Aprano: Yes, my fault. I will give an url where it is located. https://docs.python.org/3/tutorial/classes.html ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41166> _______________________________________
participants (3)
-
ABELARDO
-
Dennis Sweeney
-
Steven D'Aprano