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.

classification
Title: add __objclass__ to the docs
Type: enhancement Stage: resolved
Components: Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, CliffM, eric.araujo, ethan.furman, ezio.melotti, georg.brandl, ncoghlan, priyapappachan, python-dev, yselivanov
Priority: normal Keywords: easy, patch

Created on 2013-10-18 07:41 by ethan.furman, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
__objclass__.patch priyapappachan, 2014-03-10 09:18 _objclass__ added review
Messages (10)
msg200190 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2013-10-18 07:41
Currently __objclass__ is only documented in a ten-year old PEP.
msg200857 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2013-10-22 00:31
The proposed text is something along the lines of:

__objclass__: 1) Indicates this callable requires an instance of the given type (or a subclass) as its first positional argument; e.g. CPython sets this for unbound methods that are implemented in C rather than Python.  2) The class where this object was defined.

So, any ideas for improvement, and, more importantly, where in the docs should this go?
msg201113 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2013-10-24 11:08
Changing the order a bit, perhaps something like this in the data model section:

__objclass__: Interpreted by the inspect module as specifying the class where this object was defined (setting this appropriately can assist in runtime introspection of dynamic class attributes). For callables, may indicate that an instance of the given type (or a subclass) is expected or required as the first positional argument (for example, CPython sets this for unbound methods that are implemented in C rather than being normal Python functions).

Perhaps with a cross-reference from the classification function in inspect?
msg209599 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2014-01-28 23:07
Should we commit this in 3.4?
msg209634 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2014-01-29 12:15
Huh, I thought we did this back when Ethan was working on enum stuff, but I guess we never figured out exactly where to put it.

Considering that question again now, I suggest adding it to the end of the subsection on implementing descriptors, since that's when it is most likely to be relevant:

http://docs.python.org/dev/reference/datamodel.html#implementing-descriptors
msg213037 - (view) Author: priya (priyapappachan) * Date: 2014-03-10 15:21
I added __objclass__ to the datamodel section. Patch is submitted for the same. Can you clarify about the link to be provided from this section? I couldn't find the classification function in Documentation.
msg213071 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-10 19:08
Thanks for the patch.  Could you make sure the text wraps at 80 characters?
msg213072 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-10 19:10
I think Nick was referring to this function: http://docs.python.org/3.4/library/inspect#inspect.ismethod
msg215770 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-04-08 16:07
New changeset 0973d45197cc by Yury Selivanov in branch '3.4':
docs: Document __objclass__. Closes #19281.
http://hg.python.org/cpython/rev/0973d45197cc

New changeset 2a953cb5642d by Yury Selivanov in branch 'default':
docs: Document __objclass__. Closes #19281.
http://hg.python.org/cpython/rev/2a953cb5642d
msg215775 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-04-08 18:01
New changeset 372b19005011 by Yury Selivanov in branch '3.4':
docs: Better wording for __objclass__ docs. Issue #19281
http://hg.python.org/cpython/rev/372b19005011

New changeset febd63a7e927 by Yury Selivanov in branch 'default':
docs: Better wording for __objclass__ docs. Issue #19281
http://hg.python.org/cpython/rev/febd63a7e927
History
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63480
2014-04-08 18:01:19python-devsetmessages: + msg215775
2014-04-08 16:07:30python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg215770

resolution: fixed
stage: needs patch -> resolved
2014-03-10 19:10:01eric.araujosetmessages: + msg213072
versions: + Python 2.7, Python 3.3
2014-03-10 19:08:08eric.araujosetmessages: + msg213071
2014-03-10 15:21:37priyapappachansetnosy: + priyapappachan
messages: + msg213037
2014-03-10 09:18:31priyapappachansetfiles: + __objclass__.patch
keywords: + patch
2014-01-29 12:15:37ncoghlansetversions: + Python 3.4
messages: + msg209634

keywords: + easy
type: enhancement
stage: needs patch
2014-01-28 23:07:55yselivanovsetnosy: + yselivanov
messages: + msg209599
2013-10-24 11:08:36ncoghlansetmessages: + msg201113
2013-10-24 02:52:32ethan.furmansetnosy: + ncoghlan
2013-10-22 00:31:35ethan.furmansetmessages: + msg200857
2013-10-18 20:32:25Arfreversetnosy: + Arfrever
2013-10-18 19:41:20CliffMsetnosy: + CliffM
2013-10-18 07:41:51ethan.furmancreate