-
Notifications
You must be signed in to change notification settings - Fork 558
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
Document metaclasses and static methods #1117
base: main
Are you sure you want to change the base?
Conversation
Thought I'd have a go at this which is currently marked as a TODO.
The wording about the fact that "class is strange/unusual" is bad. Instead the documentation should extract: Lines 1276 to 1296 in c2a75f1
in some form, and this should be referenced instead, to justify the behavior. |
Well, 'Class' is an unusual class in that it has no metaclass (the only one that doesn't) and I think people will regard it as strange that it's an instance of itself - a bit reminiscent of the Russell paradox. This isn't intended as a criticism as I can understand why it's been done this way and object hierarchies of any programming language tend to have a certain amount of strangeness. Personally, I'm not in favor of including the object hierarchy diagram in what is intended to be simple, readable documentation and I don't think it highlights the strangeness of the 'Class' class very well in any case. The examples I've chosen hopefully do that. |
Well I think, the diagram should belong to the documentation, for advanced explanations of how the object model is implemented. Referring it from that change would seems logical, and would would allow some "not-personal" comments like:
|
Well, if we were to include a link to the diagram in the Class docs, then the best place to do it would be in the 'Inheritance' section which needs looking at anyway as it doesn't integrate too well with the 'Super' section at present. I'm still not keen on referencing it in the 'Metaclasses' section (I can't include a clickable link to it in a code comment anyway) as I don't think the last two examples are easy to understand without a written explanation. |
OK, I've changed the 'Metaclasses' section so that it no longer refers to 'Class' as being unusual or strange. |
I've added some wording to the 'Static methods' sub-section to make it clear that static getters, setters and operators are supported and that, whilst |
There is one remaining TODO in the Classes docs, namely better integration of the 'Super' section, and as I don't think this needs major surgery, I thought I'd include my attempt at it within this PR which I've now done. As suggested earlier by @mhermier, I've included a link to the object hierarchy diagram. |
Missing word in Static methods section.
Reading through the whole lot again, I noticed that I'd missed out a word in the 'static methods' section. Fixed now. |
Thought I'd have a go at this which is currently marked as a TODO.