bpo-33816: Remove outdated metaclass example by andresdelfino · Pull Request #7566 · python/cpython (original) (raw)
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation7 Commits2 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Perhaps it would make sense to keep the example, but caveat it as being redundant given the move to class namespaces being ordered by default?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outright removal is better than keeping the misleading example, so approving as is. However, see my comment above about potentially qualifying the example as no longer being necessary, rather than removing it entirely.
Perhaps it would make sense to keep the example, but caveat it as being redundant given the move to class namespaces being ordered by default?
The thing is that the example also depends on the fact that a specialized type like OrderedDict was needed to get an insertion-order-preserving dictionary. I think examples of the like "that thing can be implemented with this API like this:" are good, but this particular example depends on several things that have changed.
IMHO, a new example that shows a real benefit from metaclasses would be better.
I think we must not waiting removing bad document until someone writing better document
when we don't know when the better document is finished.
Additionally, metaclass is very complex feature. I don't want to promote using it.
Actually, Python is evolved to solve typical problem without metaclass: __init_subclass__
, __class_getitem__
, and PEP 520. (Maybe more)
Lack of "typical usecase" is OK. Lack of "example of typical usecase" is OK too.
People can read stdlib's code to know how metaclass is used.
Thanks @andresdelfino for the PR, and @methane for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request
(cherry picked from commit c2ccac7)
Co-authored-by: Andrés Delfino adelfino@gmail.com
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request
(cherry picked from commit c2ccac7)
Co-authored-by: Andrés Delfino adelfino@gmail.com
miss-islington added a commit that referenced this pull request
(cherry picked from commit c2ccac7)
Co-authored-by: Andrés Delfino adelfino@gmail.com
miss-islington added a commit that referenced this pull request
(cherry picked from commit c2ccac7)
Co-authored-by: Andrés Delfino adelfino@gmail.com