Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!usenetcore.com!newsfeed.xs4all.nl!newsfeed6.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; 'append': 0.07; 'attributes': 0.07; 'builtin': 0.07; 'subject:How': 0.09; 'python': 0.09; 'defined,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:command': 0.09; 'terry': 0.09; 'def': 0.10; 'arg2,': 0.16; 'args...': 0.16; 'docstring': 0.16; 'function;': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'shorthand': 0.16; 'subject:access': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'jan': 0.18; '>>>': 0.18; 'module': 0.19; 'defined': 0.22; 'command': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'skip:_ 10': 0.29; 'class': 0.29; 'function': 0.30; 'helpful': 0.30; 'stuff': 0.30; 'quickly': 0.32; 'accessible': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'self': 0.34; 'pm,': 0.35; 'subject:?': 0.35; 'there': 0.35; 'received:org': 0.36; 'method': 0.36; 'subject:: ': 0.38; 'object': 0.38; 'skip:o 20': 0.38; 'to:addr:python.org': 0.39; 'called': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'end': 0.40; 'here:': 0.62; 'between': 0.63; 'object:': 0.84; 'received:fios.verizon.net': 0.84; 'x):': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: How to access the document for __call__ from command line? Date: Thu, 18 Oct 2012 22:59:13 -0400 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0 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: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350615581 news.xs4all.nl 6942 [2001:888:2000:d::a6]:39418 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31709 On 10/18/2012 10:30 PM, Peng Yu wrote: > Hi, > > reference.pdf from python document has the following description. It > is not accessible from help() in the command line. Is there an > alternative so that I can quickly access these class attributes or > method names from the command line? > > object.__call__(self [, args... ]) > Called when the instance is =E2=80=9Ccalled=E2=80=9D as a function; if = this method is > defined, x(arg1, arg2, ...) is a > shorthand for x.__call__(arg1, arg2, ...). >>> help(object.__call__) Help on method-wrapper object: __call__ =3D class method-wrapper(object) | Methods defined here: | | __call__(...) | x.__call__(...) <=3D=3D> x(...) | snip not very helpful stuff For a user class with a __call__ method with a docstring >>> class C: def __call__(self, x): "return the difference between self and x" return self-x >>> help(C.__call__) Help on function __call__ in module __main__: __call__(self, x) return the difference between self and x Similarly for builtin methods you actually need to know about >>> help(list.append) Help on method_descriptor: append(...) L.append(object) -> None -- append object to end --=20 Terry Jan Reedy