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 and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New metaclass example for Data Model topic #77997
Comments
Since Python 3.6, when PEP-520 was accepted, class attribute definition order is preserved. That alone is sufficient to replace the example, but then 3.7 came with guaranteed dictionary insertion order. The metaclass example uses OrderedDict, what may cause confusing to new programmers, since it is not needed. I'm creating this issue in case someone who actually has used metaclasses can come up with an example, but I'll try to find/think of an example myself. |
I'm talking about the example in Data Model, 3.3.3.6. |
Probably, the entire section with the OrderedClass example should be removed. Once class dicts became ordered by default, the __prepare__ attribute lost its principal motivating use case. |
To what section are you refering by "the entire section"? On a side note: I'll make a PR to remove the example. IMHO, there should be an example to give some idea of what a metaclass can do, but the current example is no longer useful and it's confusing because of how dicts now work. |
@methane Issue seems to have been resolved. Can we close the issue? |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: