On 27/07/2012, Jerry Hill <[email protected]> wrote: ... >>>> inspect.getargspec(logging.log) > ArgSpec(args=['level', 'msg'], varargs='args', keywords='kwargs', > defaults=None) ... > Also, the help object itself is written in python. You can look at > the source in pydoc.py
On 27/07/2012, Steven D'Aprano <[email protected]> wrote: > > find out what they are and what they can do. Python has a couple of built-in > functions for introspection, plus an entire module of extra functions. > Built-ins include: dir, vars, globals, locals, hasattr, type, help ... > Plus the inspect module, which contains many other advanced introspection ... > This is where it is added to the built-ins: ... > And this is where the actual help functionality is made: ... > 1) Source code is not always available. Even when available, it can ... > 2) Even when you have the source code to read, reading the source can be ... > 3) Even if the source code is short and sweet and easy to understand, this ... Thanks for the great and comprehensive answers! I understand much better it now. When I saw that help() was a builtin, I assumed it was written in C. So it helped that you pointed me to pydoc and inspect. In pydoc I found this: if inspect.isfunction(object): args, varargs, varkw, defaults = inspect.getargspec(object) I didn't realise that so much of a "builtin" help() would be visible to me in *.py files. I naively assumed "builtin" meant compiled-from-C. > You might consider putting in a request for a documentation > change on the bug tracker. Will do. Assistance much appreciated! _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
