Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31709
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: How to access the document for __call__ from command line? |
| Date | 2012-10-18 22:59 -0400 |
| References | <CABrM6wmHbfB9=UTATEfx5zKaOO=yxp4UBHVVJDnJG4bdWLSqTA@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2492.1350615581.27098.python-list@python.org> (permalink) |
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 “called” 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__ = class method-wrapper(object)
| Methods defined here:
|
| __call__(...)
| x.__call__(...) <==> 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
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How to access the document for __call__ from command line? Terry Reedy <tjreedy@udel.edu> - 2012-10-18 22:59 -0400
csiph-web