python / cpython

The Python programming language
https://www.python.org
Other
61.86k stars 29.76k forks source link

__base__ undocumented #66646

Open 80036ac5-bb84-4d39-8416-02cd8e51707d opened 9 years ago

80036ac5-bb84-4d39-8416-02cd8e51707d commented 9 years ago
BPO 22456
Nosy @gvanrossum, @rhettinger
Files
  • function-documentation.patch: Patch containing documentation of base
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['easy', 'type-feature', 'docs'] title = '__base__ undocumented' updated_at = user = 'https://bugs.python.org/Arfrever' ``` bugs.python.org fields: ```python activity = actor = 'anupama.srinivas.murthy' assignee = 'docs@python' closed = False closed_date = None closer = None components = ['Documentation'] creation = creator = 'Arfrever' dependencies = [] files = ['36760'] hgrepos = [] issue_num = 22456 keywords = ['patch', 'easy'] message_count = 5.0 messages = ['227241', '227242', '227243', '227245', '227903'] nosy_count = 5.0 nosy_names = ['gvanrossum', 'rhettinger', 'Arfrever', 'docs@python', 'anupama.srinivas.murthy'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue22456' versions = ['Python 2.7', 'Python 3.4', 'Python 3.5'] ```

    Linked PRs

    80036ac5-bb84-4d39-8416-02cd8e51707d commented 9 years ago

    __bases is documented, but __base is not.

    $ grep -r __base__ Doc
    $ grep -r __bases__ Doc
    Doc/c-api/object.rst:are different objects, *B*'s :attr:`~class.__bases__` attribute is searched in
    Doc/c-api/object.rst:a depth-first fashion for *A* --- the presence of the :attr:`~class.__bases__`
    Doc/extending/newtypes.rst:   in its :attr:`~class.__bases__`, or else it will not be able to call your type's
    Doc/library/email.headerregistry.rst:    class's ``__bases__`` list.
    Doc/library/functions.rst:   tuple itemizes the base classes and becomes the :attr:`~class.__bases__`
    Doc/library/stdtypes.rst:.. attribute:: class.__bases__
    Doc/reference/datamodel.rst:      single: __bases__ (class attribute)
    Doc/reference/datamodel.rst:   dictionary containing the class's namespace; :attr:`~class.__bases__` is a
    Doc/whatsnew/2.3.rst:  removed: you can now assign to the :attr:`__name__` and :attr:`__bases__`
    Doc/whatsnew/2.3.rst:  assigned to :attr:`__bases__` along the lines of those relating to assigning to
    rhettinger commented 9 years ago

    I think that __base was intended to be a non-guaranteed implementation detail for new-style classes just like __dictoffset and __flags__ .

    gvanrossum commented 9 years ago

    Raymond is correct. __base__ is closely tied to the C implementation. I think it might be worth a mention, but with an explicit note that it is CPython-specific. It is sometimes useful, e.g. when wondering why a certain case of multiple inheritance is rejected.

    80036ac5-bb84-4d39-8416-02cd8e51707d commented 9 years ago

    __base__ exists also in Jython and PyPy.

    e9c27455-44d3-4d24-8fff-560f86bcd2d4 commented 9 years ago

    I have documented the function in object.rst file. I do not know the use of the function and have not mentioned that. My documentation is based on what I understood from the comments below and the explanation here: http://code.activestate.com/lists/python-list/334282/

    furkanonder commented 1 year ago

    __bases__ is an undocumented feature. I believe it is worth mentioning in the object.rst , stdtypes.rst and datamodel.rst documents.

    merwok commented 1 year ago

    It’s an undocumented implementation detail, not a language feature.

    furkanonder commented 1 year ago

    @arhadthedev Why did you close the issue? PR was opened for this issue and it was being considered.

    arhadthedev commented 1 year ago

    I've made a decision based on the last comment in the issue from a core dev:

    It’s an undocumented implementation detail, not a language feature.

    followed by a two-month silence. Thank you for clarification, reopening.

    furkanonder commented 1 year ago

    @arhadthedev Thanks!