Created on 2010-11-08 19:19 by terry.reedy, last changed 2022-04-11 14:57 by admin. This issue is now closed.
msg120795 - (view) Author: Terry J. Reedy (terry.reedy) * Date: 2010-11-08 19:19In 3.x, "(object)" is now superfluous in class statements. Reference manual 7.7. Class definitions has simply class Foo: pass In library manual 2. Built-in Functions, class examples for classmethod and staticmethod are the same. Class examples for dir, property, and type still have '(object)' in their class examples. Section 5.11.4. Methods example omits it. I cannot think of anywhere else there should be such examples. I think we should be consistent and remove the remaining occurrences of '(object)' in the function examples. They can only confuse newcomers. This part is easy. I also think the doc for 'class' should say that the default inheritance is from the base class *object* (I presume this should be true in all implementations) and that class Foo(object): pass is the same as the above (unless the name 'object' has been rebound!).msg120798 - (view) Author: Éric Araujo (eric.araujo) * Date: 2010-11-08 19:51
Other unneeded uses of object, courtesy of grep: library/sqlite3.rst:713: class Point(object): library/multiprocessing.rst:1335: class MathsClass(object): library/functions.rst:281: >>> class Foo(object): library/functions.rst:897: class C(object): library/functions.rst:916: class Parrot(object): library/functions.rst:933: class C(object): library/functions.rst:1237: >>> class X(object): library/argparse.rst:1315: >>> class C(object): library/ctypes.rst:372: >>> class Bottles(object): library/itertools.rst:326: class groupby(object): howto/descriptor.rst:156: class RevealAccess(object): howto/descriptor.rst:173: >>> class MyClass(object): howto/descriptor.rst:205: class C(object): howto/descriptor.rst:214: class Property(object): howto/descriptor.rst:250: class Cell(object): howto/descriptor.rst:278: class Function(object): howto/descriptor.rst:286: >>> class D(object): howto/descriptor.rst:358: >>> class E(object): howto/descriptor.rst:371: class StaticMethod(object): howto/descriptor.rst:384: >>> class E(object): howto/descriptor.rst:419: class ClassMethod(object): howto/sorting.rst:228: class K(object): reference/datamodel.rst:1990: >>> class C(object): includes/sqlite3/adapter_point_2.py:3:class Point(object): includes/sqlite3/converter_point.py:3:class Point(object): includes/sqlite3/adapter_point_1.py:3:class Point(object): includes/mp_newtype.py:15:class Foo(object):msg121115 - (view) Author: Xuanji Li (xuanji) * Date: 2010-11-13 05:51
Attached a patch to implement the suggested changes on 3.2. If the patch is ok I can do the same for 3.1.msg122034 - (view) Author: Éric Araujo (eric.araujo) * Date: 2010-11-22 00:11
I will commit the patch this week unless someone opposes to it. We still need a doc change as described in Terry’s original message.msg122043 - (view) Author: Xuanji Li (xuanji) * Date: 2010-11-22 00:26
Hi eric, what doc change are you referring to?msg122045 - (view) Author: Éric Araujo (eric.araujo) * Date: 2010-11-22 00:27
“I also think the doc for 'class' should say that the default inheritance is from the base class *object*”msg122046 - (view) Author: Raymond Hettinger (rhettinger) * Date: 2010-11-22 00:33
These mostly look good. Do leave the howto documents as-is. They have some value across multiple versions of Python. Also, the descriptor how-to in particular gets some benefit from keeping (object) explicit because it helps remind users which version of __getattribute__ is being run. Other than the how-tos, please go ahead and apply.msg122081 - (view) Author: Éric Araujo (eric.araujo) * Date: 2010-11-22 03:20
The patch actually already contained a doc change addressing Terry’s second request, thank you Xuanji Li. I reverted the changes to howto as per Raymond’s comment, made some other slight editions (like removing trailing whitespace) and committed as r86670 and r86672.Date User Action Args 2022-04-11 14:57:08 admin set github: 54575 2010-11-22 03:20:35 eric.araujo set status: open -> closed
stage: patch review -> resolved
2010-11-22 00:33:09 rhettinger set nosy: + rhettingermessages: + msg122043
2010-11-22 00:11:59 eric.araujo set status: open -> pendingassignee: docs@python -> eric.araujo
nosy: + xuanji
keywords: + patch
2010-11-08 19:52:51 belopolsky set nosy: + belopolskyRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4