This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Type: Stage: resolved
Components: Documentation Versions: Python 3.8
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: docs@python Nosy List: ABELARDOLG, Dennis Sweeney, docs@python, steven.daprano
Priority: normal Keywords:

Created on 2020-06-30 07:01 by ABELARDOLG, last changed 2022-04-11 14:59 by admin. This issue is now closed.

File name Uploaded Description Edit
Captura de pantalla de 2020-06-30 08-50-39.png ABELARDOLG, 2020-06-30 07:01
Messages (6)
msg372660 - (view) Author: ABELARDO (ABELARDOLG) Date: 2020-06-30 07:01
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.
msg372662 - (view) Author: Dennis Sweeney (Dennis Sweeney) * (Python committer) Date: 2020-06-30 08:18
I think the word "attribute" is preferred over "value" because "value" can mean just about anything, whereas, according to , 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 ``.

Unless I misunderstand you, I don't think there is an issue.
msg372663 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2020-06-30 08:19
"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:

and Scala talks about "value classes", but neither seem to be what you are talking about.

See also:
msg372664 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2020-06-30 08:23
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.
msg372667 - (view) Author: ABELARDO (ABELARDOLG) Date: 2020-06-30 08:51
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.
msg372668 - (view) Author: ABELARDO (ABELARDOLG) Date: 2020-06-30 08:53
Steven D'Aprano:

Yes, my fault. I will give an url where it is located.
Date User Action Args
2022-04-11 14:59:33adminsetgithub: 85338
2020-06-30 08:53:12ABELARDOLGsetmessages: + msg372668
2020-06-30 08:51:02ABELARDOLGsetmessages: + msg372667
2020-06-30 08:23:14steven.dapranosetmessages: + msg372664
2020-06-30 08:19:55steven.dapranosetstatus: open -> closed

nosy: + steven.daprano
messages: + msg372663

resolution: rejected
stage: resolved
2020-06-30 08:18:18Dennis Sweeneysetnosy: + Dennis Sweeney
messages: + msg372662
2020-06-30 07:01:22ABELARDOLGcreate