Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61357
| 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 | <python-python-list@m.gmane.org> |
| 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 <tjreedy@udel.edu> |
| Subject | Re: interactive help on the base object |
| Date | Mon, 09 Dec 2013 00:00:53 -0500 |
| References | <l7t00b$hp7$1@ger.gmane.org> <l7tu0b$s3o$1@ger.gmane.org> <mailman.3748.1386546562.18130.python-list@python.org> <l833rs$jik$1@dont-email.me> <l83787$q6$1@ger.gmane.org> |
| 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 | <l83787$q6$1@ger.gmane.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3759.1386565266.18130.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
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 "<pyshell#8>", line 1, in <module>
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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: interactive help on the base object Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-08 23:48 +0000
Re: interactive help on the base object Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-09 00:45 +0000
Re: interactive help on the base object Mark Janssen <dreamingforward@gmail.com> - 2013-12-08 17:09 -0800
Re: interactive help on the base object Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-09 01:38 +0000
Re: interactive help on the base object Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-09 01:43 +0000
Re: interactive help on the base object Steven D'Aprano <steve@pearwood.info> - 2013-12-09 02:31 +0000
Re: interactive help on the base object Mark Janssen <dreamingforward@gmail.com> - 2013-12-08 18:41 -0800
Re: interactive help on the base object rusi <rustompmody@gmail.com> - 2013-12-08 18:58 -0800
Re: interactive help on the base object Steven D'Aprano <steve@pearwood.info> - 2013-12-09 04:16 +0000
Re: interactive help on the base object rusi <rustompmody@gmail.com> - 2013-12-08 20:46 -0800
Re: interactive help on the base object rurpy@yahoo.com - 2013-12-08 21:26 -0800
Re: interactive help on the base object rusi <rustompmody@gmail.com> - 2013-12-08 22:44 -0800
Re: interactive help on the base object Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-09 09:44 +0000
Re: interactive help on the base object Steven D'Aprano <steve@pearwood.info> - 2013-12-09 05:44 +0000
Re: interactive help on the base object Alan Bawden <alan@scooby-doo.csail.mit.edu> - 2013-12-09 02:31 -0500
Re: interactive help on the base object Chris Angelico <rosuav@gmail.com> - 2013-12-09 18:39 +1100
Re: interactive help on the base object Alan Bawden <alan@scooby-doo.csail.mit.edu> - 2013-12-10 00:34 -0500
Re: interactive help on the base object Chris Angelico <rosuav@gmail.com> - 2013-12-10 16:44 +1100
Re: interactive help on the base object Chris Angelico <rosuav@gmail.com> - 2013-12-09 13:57 +1100
Re: interactive help on the base object Terry Reedy <tjreedy@udel.edu> - 2013-12-09 00:00 -0500
Re: interactive help on the base object Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-09 23:48 +0000
Re: interactive help on the base object Steven D'Aprano <steve@pearwood.info> - 2013-12-09 01:58 +0000
csiph-web