| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Please correct me if there's some gotcha I'm missing, but if classes inherit from object, then don't they also do that when created via type? >>> type('X', (object,), dict(a=1)).__bases__
(<class 'object'>,)
>>> type('X', (), dict(a=1)).__bases__
(<class 'object'>,) |
Sorry, something went wrong.
|
No gotcha, in Python 3 both are equivalent. This means that this bit of the docs (a couple paragraphs before your change) is not strictly accurate:
object ends up in __bases__ even when implicitly added by the metaclass! |
Sorry, something went wrong.
There was a problem hiding this comment.
E'ric, can you finish this off, with blurb and possible additional doc change?
Sorry, something went wrong.
|
Hi! I will come back to this. |
Sorry, something went wrong.
|
@taleinat @terryjreedy Please review additional changes!
|
Sorry, something went wrong.
|
I have added the skip news and backport labels. If there is no negative review about the wording I will merge this in a couple days! |
Sorry, something went wrong.
There was a problem hiding this comment.
This is an important fix and I like the direction!
However, the new wording is still not accurate: When providing one or more base classes, object is not added to __bases__. For example:
>>> class A:
pass
>>> type('B', (A,), {}).__bases__
(<class '__main__.A'>,)Also, if the attributes dict doesn't become __dict__, what exactly is done with it? Perhaps this would be a good place for a link to the docs about class instantiation?
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
It is passed to the metaclass so that functions become methods, other descriptors do their thing, and all attributes are stored in the class object in the end… in TheClass.__dict__! (instance __dict__ is only for instance attributes) |
Sorry, something went wrong.
|
Text I removed:
so it was not wrong but could be confusing; what do you think about this change:
(let me check if the link target only talks about class instances) |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. Small suggestion about the NEWS entry, @terryjreedy.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. And if you don't make the requested changes, you will be put in the comfy chair! |
Sorry, something went wrong.
Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com>
…LK7Ps.rst Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com>
| :attr:`~class.__bases__` attribute; if empty, :class:`object`, the | ||
| ultimate base of all classes, is added. The *dict* dictionary contains | ||
| attribute and method definitions for the class body; it may be copied | ||
| or wrapped before becoming the :attr:`~class.__dict__` attribute. |
There was a problem hiding this comment.
Where does this link go?
class.__bases__ is at https://docs.python.org/3/library/stdtypes.html#class.__bases__
does class.__dict__ go to https://docs.python.org/3/reference/datamodel.html#index-48 ?
Sorry, something went wrong.
There was a problem hiding this comment.
No link is created!
Ideas:
Sorry, something went wrong.
There was a problem hiding this comment.
Since I changed object to class and that does not work, I changed it back for this issue, so it continues to link to
file:///F:/dev/3x/Doc/build/html/library/stdtypes.html#object.dict
Since 'objects' include 'classes', the current text is not incorrect. I consider changing it a separate issue.
If classes were the only objects with dict attribute (I am not sure), and object.dict should be class.dict, a change would require grepping for other references to change. This would be a different issue also.
Sorry, something went wrong.
|
Thanks @verhovsky for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9. |
Sorry, something went wrong.
Co-authored-by: Éric Araujo <merwok@netwok.org> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com> (cherry picked from commit 644d528) Co-authored-by: Борис Верховский <boris.verk@gmail.com>
|
GH-24295 is a backport of this pull request to the 3.9 branch. |
Sorry, something went wrong.
Co-authored-by: Éric Araujo <merwok@netwok.org> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com> (cherry picked from commit 644d528) Co-authored-by: Борис Верховский <boris.verk@gmail.com>
|
GH-24296 is a backport of this pull request to the 3.8 branch. |
Sorry, something went wrong.
Co-authored-by: Éric Araujo <merwok@netwok.org> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com> (cherry picked from commit 644d528) Co-authored-by: Борис Верховский <boris.verk@gmail.com>
|
Boris, you have 6 merged PRs before this. After checking them, I think you qualify for a listing in Misc/acks. If you make a PR with no issue or news to add yourself, with the improved English transliteration, and request my review, I will merge it, and ask for a 3.9 backport. |
Sorry, something went wrong.
Co-authored-by: Éric Araujo <merwok@netwok.org> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com> (cherry picked from commit 644d528) Co-authored-by: Борис Верховский <boris.verk@gmail.com>
Co-authored-by: Éric Araujo <merwok@netwok.org> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Tal Einat <532281+taleinat@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
https://bugs.python.org/issue40304