New submission from Aahz aahz@pythoncraft.com:
http://docs.python.org/dev/tutorial/classes.html
Chapter 9 of the Tutorial contains this intro paragraph:
Python's class mechanism adds classes to the language with a minimum of new syntax and semantics. It is a mixture of the class mechanisms found in C++ and Modula-3. As is true for modules, classes in Python do not put an absolute barrier between definition and user, but rather rely on the politeness of the user not to "break into the definition." The most important features of classes are retained with full power, however: the class inheritance mechanism allows multiple base classes, a derived class can override any methods of its base class or classes, and a method can call the method of a base class with the same name. Objects can contain an arbitrary amount of data.
A coworker found particularly the third sentence incomprehensible, and even with ten years of Python under my belt, I can't say that it makes much more sense to me. I know what it must be trying to say and therefore proffer this suggested rewrite:
Compared with other programming languages, Python's class mechanism adds classes with a minimum of new syntax and semantics. It is a mixture of the class mechanisms found in C++ and Modula-3. Python classes provide all the standard features of Object Oriented Programming: the class inheritance mechanism allows multiple base classes, a derived class can override any methods of its base class or classes, and a method can call the method of a base class with the same name. Objects can contain arbitrary amounts and kinds of data. As is true for modules, classes partake of the dynamic nature of Python; users of a class can modify or break the class definition even without changing the source code.
---------- assignee: docs@python components: Documentation messages: 109080 nosy: aahz, docs@python priority: critical severity: normal stage: patch review status: open title: Tutorial: classes intro paragraph icky type: behavior versions: Python 2.7
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue9138 _______________________________________
Raymond Hettinger rhettinger@users.sourceforge.net added the comment:
+1 on the new wording.
Nits:
* Since many OOP languages don't support multiple inheritance, I don't think we can call multiple inheritance one of the "standard features of Object Oriented Programming".
* Eventhough the wording is an improvement, I don't see how this could be prioritized as "critical".
---------- nosy: +rhettinger
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue9138 _______________________________________
Much better definition. I stripped it down a little to avoid "mechanism" repetition.
Compared with other programming languages, Python provides object oriented approach with a minimum of new syntax and semantics. Its class mechanism is a mixture of concepts found in C++ and Modula-3. Python classes can be inherited from multiple base classes, a derived class can override any methods of its base class or classes, and a method can call the method of a base class with the same name. Objects can contain arbitrary amounts and kinds of data. As is true for modules, classes partake of the dynamic nature of Python; users of a class can modify or break the class definition even without changing the source code.
However, the sentence about arbitrary amounts and kinds of data seems strange to me. I would like to see it like "In comparison to XXX where there is limitation that YYY Python objects can contain arbitrary amounts and kinds of data."
"users of a class can modify or break the class definition even without changing the source code." doesn't sound right to me. How can I *break* the class definition? Maybe it was meant to
The dynamic nature of Python allows new classes to be defined and existing classes modified at run-time.
Georg Brandl georg@python.org added the comment:
Committed Aahz' version, with the last sentence reworded to what I think is more positive than what sounds like "you can break things without doing anything".
---------- nosy: +georg.brandl resolution: -> fixed status: open -> closed
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue9138 _______________________________________
Georg Brandl georg@python.org added the comment:
r85627.
----------
_______________________________________ Python tracker report@bugs.python.org http://bugs.python.org/issue9138 _______________________________________