Hacker News new | past | comments | ask | show | jobs | submit login

In a python repl dir(object) and help, help(object) are what you are looking for. Both these functions are in the default namespace

    dir(__builtins__) 
Returns a list of strings for all the names bound in the prelude namespace.

    dir(list)
Returns a list of strings for all the methods on the list class.

    dir([])
Will return a all the methods on a particular instance.

etc… the same caveats apply to dir with getattr etc as to method_missing. additional caveat i dont care to test; it may not work on an old style class instance.

help has its __repr__ defined to tell you how to use it. It will allow you to read the doc strings for a namespace, object or function. However i prefer to run 'pydoc -p 8888' in my projects top level; this will start an http server on port 8888 that lets you interactively browser your projects docstrings and all the modules on its pythonpath.

Hope that helps




Thanks :) that will be useful if i dig back into mucking around with Python.


Better yet, use the help() function instead, which also displays the docstrings for said object and functions (assuming the programmer gave those, which fortunately holds for the entire stdlib).




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: