Path: csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'newbie': 0.05; 'root': 0.05; 'tree': 0.05; '"""': 0.07; 'attribute': 0.07; 'variables': 0.07; 'subject:help': 0.08; "'a'": 0.09; 'classes.': 0.09; 'inherited': 0.09; 'lawrence': 0.09; 'methods,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'rejected': 0.09; 'suggestions.': 0.09; 'python': 0.11; 'jan': 0.12; 'question.': 0.14; 'thread': 0.14; "'''": 0.16; "'__doc__',": 0.16; 'attributes.': 0.16; 'bit.': 0.16; 'descriptors': 0.16; 'drifting': 0.16; 'grounds': 0.16; 'object()': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'reminded': 0.16; 'subclass': 0.16; 'subclasses': 0.16; 'subject:object': 0.16; 'so.': 0.16; 'wrote:': 0.18; 'module': 0.19; 'else,': 0.19; 'thanks.': 0.20; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'issue,': 0.24; 'equivalent': 0.26; 'references': 0.26; 'tracker': 0.26; 'defined': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'raise': 0.29; 'wonder': 0.29; 'dec': 0.30; 'along': 0.30; "i'm": 0.30; 'asked': 0.31; "skip:' 10": 0.31; '"",': 0.31; '>>>>': 0.31; 'file': 0.32; 'class': 0.32; 'lists': 0.32; 'another': 0.32; 'open': 0.33; '(most': 0.33; 'subject:the': 0.34; 'classes': 0.35; 'etc': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'explains': 0.36; 'instances': 0.36; 'object,': 0.36; 'thanks': 0.36; "i'll": 0.36; 'should': 0.36; 'list': 0.37; 'skip:o 20': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'fact': 0.38; 'pm,': 0.38; 'recent': 0.39; 'expect': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'improved': 0.60; 'most': 0.60; 'interested,': 0.61; 'issues,': 0.61; 'no.': 0.61; 'received:173': 0.61; 'first': 0.61; 'here:': 0.62; "you've": 0.63; 'name': 0.63; 'situation': 0.65; 'default': 0.69; 'special': 0.74; "'object'": 0.84; 'odds': 0.84; 'received:fios.verizon.net': 0.84; 'subject:base': 0.84; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: interactive help on the base object Date: Mon, 09 Dec 2013 00:00:53 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 96 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386565266 news.xs4all.nl 2831 [2001:888:2000:d::a6]:55778 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61357 On 12/8/2013 8:43 PM, Mark Lawrence wrote: > On 09/12/2013 00:45, Denis McMahon wrote: >> On Sun, 08 Dec 2013 23:48:57 +0000, Mark Lawrence wrote: >> >>>>> >>> help(object) >>>>> Help on class object in module builtins: >>>>> >>>>> class object >>>>> | The most base type >> >> >>>> '''The default top superclass for all Python classes. >>>> Its methods are inherited by all classes unless overriden. >>>> ''' I said 'top' instead of 'bottom' or 'base' to loosen up thinking a bit. I did not expect Mark to make a mound out of that flip. >>> Terry's suggestion above remains odds on favourite on the grounds that >>> there have been no other suggestions. I'll give it another day, then >>> raise a tracker issue, unless the overwhelming smell of pot that has >>> been drifting around this thread knocks me unconscious. >> >> """ The root class for all Python classes. Its methods are inherited by >> all classes unless overriden. """ 'Root' is even better, since it does not depend on whether a tree is drawn up or down. Thanks. > Thanks Denis, you've reminded me why I asked in the first place. What > methods, if any does it provide? Good question. >>> dir(object) ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__'] > Are they all abstract? etc??? No. > Personally I'm not really interested, but a newbie might well be and > hence might wonder what the hell is going on. For everything else, help lists the special name methods directly associated with the object, along with docstrings. >>> help(C) Help on class C in module __main__: class C(builtins.object) | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) I think help should do the same for object >>> object.__hash__.__doc__ 'x.__hash__() <==> hash(x)' is equivalent to | __abs__(...) | x.__abs__() <==> abs(x) etc printed for help(int) The fact that __dict__ does not exist for object but is only added for subclasses explains why one must subclass object to get instances that allow attributes. >>> o = object() >>> o.a = 1 Traceback (most recent call last): File "", line 1, in o.a = 1 AttributeError: 'object' object has no attribute 'a' >>> c = C() >>> c.a=1 > If and only if the > situation can be improved I'll raise an issue I think it can be. If you prefer me to open the issue, say so. We should look for existing issues, and closed issues that rejected change. -- Terry Jan Reedy