The dir() function is designed for interactive use, inspecting objects for
the names of attributes and methods.

Here is an enhanced version that allows you to pass a glob to filter the
names you see:

http://code.activestate.com/recipes/577774-enhancing-dir-with-globs/

E.g. instead of this:

>>> dir(str)
['__add__', '__class__', 
 ... snip 60+ other names ... 
 'upper', 'zfill']

you can easily filter the results to show only names that interest you, by
passing a glob:

>>> dir(str, '*split*')
['rsplit', 'split', 'splitlines']


Comments and improvements welcome.



-- 
Steven

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to